[Samba] Import USER and PASSWORD Samba3+OpenLadp TO Samba4

L.P.H. van Belle belle at bazuin.nl
Wed Aug 26 15:26:32 UTC 2015


Hai, 
just make a CSV file and import your users. 

this is the script i used. 

#!/bin/bash
## example
## display naam in AD wil be : Louis van Belle (
cat /home/samba/backup/users.csv | awk -F ";" '{system("/usr/bin/samba-tool user add "$5" --mail-address="$7" \
--given-name="$4" --surname=\""$3"\" --telephone-number="$6" --department="$1" --description=\""$1"\" \
--random-password --userou=ou=Company")}';

the layout of the CSV( which i got from an export of my samba3+ldap) 
IT-Department;L.P.H.;van Belle;Louis;my-loginname;phonenummer;e-mail at domain.tld;

use : samba-tool user add --help 
for more examples

this is how it for you would be.. where the password is WelkomUsername

/usr/bin/samba-tool user add "$5" "Welkom$5" --mail-address="$7" \
--given-name="$2" --surname=\""$3"\" --telephone-number="$6" \
--department="$1" --description=\""$1"\" --userou=ou=Company \
--must-change-at-next-login

Just notice that i made an separated OU for my company.. ( see also the help ) 


Greetz, 

Louis


>-----Oorspronkelijk bericht-----
>Van: samba [mailto:samba-bounces at lists.samba.org] Namens vinifa
>Verzonden: woensdag 26 augustus 2015 17:01
>Aan: samba at lists.samba.org
>Onderwerp: Re: [Samba] Import USER and PASSWORD 
>Samba3+OpenLadp TO Samba4
>
>Really did not work, if I create a user in RSAT no password, 
>and select the
>option to change password at next logon, works. Now if I 
>import the LDIF
>even enabling this function does not work. This issue of 
>password, you know
>how I can put a default password for all users, such as 123456?
>
>I did not understand what you sent me.
>
>replace: unicodePwd
>unicodePwd :: $ unicodePwd "
>
>To get $ unicodePwd, I would do this:
>
>UnicodePwd = $ (echo -n "\" $ _ user_pw \ "" | $ _ICONV -f -t 
>UTF-8 UTF-16LE
>|
>$ _BASE64 -w 0)
>
>
>
>--
>View this message in context: 
>http://samba.2283325.n4.nabble.com/Import-USER-and-PASSWORD-Sam
>ba3-OpenLadp-TO-Samba4-tp4690180p4690271.html
>Sent from the Samba - General mailing list archive at Nabble.com.
>
>-- 
>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