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

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



We have a adduser script, that reads in the groupid, first, and last name, and sets them as variables, and then
adds them to the system as follows(forcing password as their password, but that could also be done as a variable)


smbldap-useradd.pl -a -m -g $gid -c "$first $last" $uname
echo -e password\\npassword|smbldap-passwd.pl $uname
chown -Rf $uname.$gid /home/$uname
chmod -Rf og+rX-w,u+rwX /home/$uname

Hope this helps...
I believe there is an error with the above method, but it does work.(smbldap-passwd.pl doesn't like it, but it accepts it...just complains)




David Trask wrote:

I could use some help creating a mass (bulk) import user script for my
LDAP/Samba set up.  I have two scripts that I use to create my
users....they are:

smbldap-useradd.pl http://www.vcs.u52.k12.me.us/linux/smbldap-useradd.pl

smbldap-passwd.pl http://www.vcs.u52.k12.me.us/linux/smbldap-passwd.pl

I've posted them for anyone who wants a look or they're also at
www.idealx.org  in the Samba projects area under smbldap-tools.

Now....here's where I'm at....I have created a simple shell to create the
users.....did this using a spreadsheet program....quite easy to do...and
it works....example below...

#!/bin/sh
smbldap-useradd.pl -a -m -c "Scooby Doo" sdoo
smbldap-useradd.pl -a -m -c "Daffy Duck" dduck
smbldap-useradd.pl -a -m -c "Rudolph Reindeer" rreindeer
smbldap-useradd.pl -a -m -c "Kris Kringle" kkringle

Easy enough....but adding the passwords is where it gets me....the
smbldap-passwd.pl script from above prompts for a password...and then I
need to type it in.  What I need to be able to do is get the password onto
the command line with the script....like so...possibly

#!/bin/sh
smbldap-passwd sdoo | mysecretpwd
smbldap-passwd dduck | myothersecretpwd

and so forth.....or I can use any other better ideas....can any of you
scripting pros out there give me a hand?  Thanks!

I'd like to be able to have the script use a text file similar to username,First Name Last Name, password (possibly group?)

right now I use the following command

smbldap-useradd.pl -a -m -c "John Doe" jdoe

That adds the user...and then I have to run the password script....

smbldap-passwd.pl jdoe
type new password:
retype new password:

It's the password prompt that throws me...otherwise I could simply do it
all with a shell script....

smbldap-passwd jsmith
smbldap-passwd jdoe
smbldap-passwd jjohnson
smbldap-passwd msmith

so forth and so on.....

Can anyone help out?  I haven't a clue about perl scripts and I could
really use the help.....fame and fortune could be yours...not to mention
my gratitude and the gratitude of others who would use this.

Thanks! :-)

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


_______________________________________________
K12OSN mailing list
K12OSN redhat com
https://www.redhat.com/mailman/listinfo/k12osn
For more info see <http://www.k12os.org>







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