[Samba] Modify email entry on AD users

Rowland Penny rpenny at samba.org
Mon Feb 26 15:46:43 UTC 2018

On Mon, 26 Feb 2018 12:25:37 -0300
Elias Pereira via samba <samba at lists.samba.org> wrote:

> Hello,
> I have about 1000 users who are without the email attribute and would
> like to update this.
> Via "samba-tool user edit" is it possible? If so, any examples?

By its very nature, 'samba-tool user edit' is meant to be used on a
user by user basis and more importantly, interactively, so no, I don't
think this will work.

> Via "ldapmodify" I believe that it is possible?! How can I do this
> directly in a command?

Your best bet is to write a script around ldbmodify. You could store
the usernames and their email addresses in a file. Read the file, line
by line, find the users DN with ldbsearch, then create an ldif similar
to this:

changetype: modify
add: mail

Add the ldif with ldbmodify, rinse & repeat for the next user ;-)


More information about the samba mailing list