Shell script
Garrett Goebel
garrett at scriptpro.com
Wed Nov 12 21:29:17 CST 2003
brad wrote:
> Garrett wrote:
> > perl -lnae '`useradd $F[0]`' filename
> >
> > Works for me...
> >
> > Where filename's contents look like:
> >
> > username1 password1
> > username2 password2
> > usernamen passwordn
> >
> > P.S. These are the kind problems for which Larry Wall
> > created Perl...
>
> This words great for useradd, but how then would you set the password
> for each user?
perl -lnae '`useradd $F[0]` filename
perl -lnae 'print "$F[0]:$F[1]n"' filename | chpasswd
You have to break it into two lines, otherwise both useradd and chpasswd
will attempt to hold a lock on the passwd file...
--
Garrett Goebel
IS Development Specialist
ScriptPro Direct: 913.403.5261
5828 Reeds Road Main: 913.384.1008
Mission, KS 66202 Fax: 913.384.2180
www.scriptpro.com garrett at scriptpro dot com
More information about the Kclug
mailing list