A simple Bash file for importing SAMBA users from a file
Hi
I need a a bash file that will import samba users and also create a default password. I currently have a CSV file like this Code:
username1, password1 Code:
smbldap-adduser username1 -P password1 Any ideas? |
Quote:
Code:
#!/bin/bash |
Thanks for that rweaver - worked great
I gave you the wrong command though. For anyone else using this script use smbldap-useradd not smbldap-adduser. cheers |
Quote:
http://www.linuxquestions.org/questi...script-693777/ |
not working
|
Quote:
|
Here is my file
Code:
Should work OK |
Quote:
eg: Code:
echo $SLAU -a -m $UN |
[root@fs test]# ls
slua slup.csv smbldap-conf test1 useradd_smbpwd [root@fs test]# cat slup.csv sri, sri [root@fs test]# cat slua #!/bin/bash CSVFILE=/root/test/slup.csv SLAU=`which smbldap-useradd` for i in `cat $CSVFILE|sed 's/, /, /g'`; do UN=`echo $i | cut -f1 -d','` #PW=`echo $i | cut -f2 -d','` echo $SLAU -a -m $UN done [root@fs test]# ./slua /usr/sbin/smbldap-useradd -a -m sri /usr/sbin/smbldap-useradd -a -m sri [root@fs test]# pdbedit -L sri Username not found! [root@fs test]# any correction in this details? |
Quote:
Code:
for i in `cat $CSVFILE|sed 's/, /,/g'`; do |
That looks correct prakash0106.
Now remove the "echo" and the "#" in front of the PW command and execute the command for real. |
hi,
thanks yaar, now its working. 1 small question i need smbldap-useradd with -g "Domain Users" -G (group name)(user name) please give ur guide sorry 2 disturb u........ prakash.m |
All times are GMT -5. The time now is 09:46 PM. |