[Samba] Add users to samba using a list.
Daniel Carrasco Marín
danielmadrid19 at gmail.com
Wed May 6 02:38:50 MDT 2015
Hi,
I'm using a file separated with ";" with the following structure:
user;name;surname;password
and this script:
while read linea
do
UserN=$(echo ${linea}|cut -d ";" -f1)
UserP=$(echo ${linea}|cut -d ";" -f4)
UserNom=$(echo ${linea}|cut -d ";" -f2)
UserApp=$(echo ${linea}|cut -d ";" -f3)
samba-tool user add "${UserN}" "${UserP}" --given-name="${UserNom}"
--surname="${UserApp}" --home-drive=U
--home-directory="\\\\homesrv\\home\\${UserN}" --script-path="logon.bat"
--profile-path="\\\\profilesrv\\profiles\\${UserN}"
sleep 1
done < users.txt
Greetings!!
2015-05-06 10:15 GMT+02:00 L.P.H. van Belle <belle at bazuin.nl>:
> i use the following, just and example for adding multiple users.
>
> cat /home/samba/backups/users.csv | awk -F ";"
> '{system("/usr/bin/samba-tool user create "$5" --mail-address="$7" \
> --given-name="$2" --surname=\""$3"\" --telephone-number="$6"
> --department="$1" --description=\""$1"\" \
> --userou=ou=Bazuin --random-password")}';
>
> Greetz,
>
> Louis
>
>
>
> >-----Oorspronkelijk bericht-----
> >Van: rowlandpenny at googlemail.com
> >[mailto:samba-bounces at lists.samba.org] Namens Rowland Penny
> >Verzonden: woensdag 6 mei 2015 10:08
> >Aan: samba at lists.samba.org
> >Onderwerp: Re: [Samba] Add users to samba using a list.
> >
> >On 06/05/15 08:43, Joakim x wrote:
> >> Hi! I'm trying to create a script wich allows me to add
> >users to samba based on a list.
> >>
> >> The list got the structure:
> >>
> >> user1
> >> user2
> >> user3
> >>
> >> (one value on each line)
> >> Is there a simple way to add these users (with home folders)
> >to the samba-system with the password
> >> "BasicPassword" ?
> >>
> >> Thanks :)
> >>
> >>
> >
> >You are probably going to have to write your own script, but,
> >from what
> >you have posted, it is hard to advise you further, what type of samba
> >install ? standalone server, NT-4 style PDC, AD DC or what ?
> >
> >Rowland
> >
> >--
> >To unsubscribe from this list go to the following URL and read the
> >instructions: https://lists.samba.org/mailman/options/samba
> >
> >
>
> --
> To unsubscribe from this list go to the following URL and read the
> instructions: https://lists.samba.org/mailman/options/samba
>
More information about the samba
mailing list