[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: RE: [K12OSN] Bulk user help for LDAP/Samba



Hi Dennis!  (and all)

I used the script just as it was written on the list.  Here it is below....
+++++++++++++++++++++++++++++++++
In your case, you could read all of the variables in from a text file,
comma delimited...
For example:
A file containing use information called usserinfo:

First,last,group,password,username

Scooby,Doo,1001,hewwowaggy,sdoo


#!/bin/sh
Cat userinfo|while read line; do
first=$(echo $line|cut -f1 -d ',')
last=$(echo $line|cut -f2 -d ',')
gid=$(echo $line|cut -f3 -d ',')
password=$(echo $line|cut -f4 -d ',')
uname=$(echo $line|cut -f5 -d ',')
smbldap-useradd.pl -a -m -g $gid -c "$first $last" $uname
echo -e $password\\n$password|smbldap-passwd.pl $uname
chown -Rf $uname.$gid /home/$uname
chmod -Rf og+rX-w,u+rwX /home/$uname
done


I saved the above script with a name like   useraddscript.sh     and ran
it using      

. useraddscript.sh

(make sure the userinfo file you create with the user information and
passwords is in the same directory)  One word of caution....there will be
an error message that pops up with each time it works on a user....doesn't
mean anything...it still works....you'll see a message that says "all
authentication tokens updated"   this means it's working fine.  Ignore the
little error.  If you get more than that...then worry.  NOTE:  as a group
we need to find a way to make the message go away.....

My Samba LDAP how-to is located here  http://www.vcs.u52.k12.me.us/linux

We'll be going over a lot of it at the Gould Academy Summer Linux
Workshop....more info here....   

http://network.gouldacademy.org/modules.php?name=News&file=article&sid=14

Hope you can make it.....

David N. Trask
Technology Teacher/Coordinator
Vassalboro Community School
dtrask vcs u52 k12 me us
(207)923-3100




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]