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:
dn: $USERSDN
changetype: modify
add: mail
mail: $USERS_EMAIL_ADDRESS
-
Add the ldif with ldbmodify, rinse & repeat for the next user ;-)
Rowland