falstaff@lennon.postino.com
Fri, 10 Sep 1999 22:26:24 -0700 (PDT)
I am probably getting punchy tonight, because I am sure I am missing
something simple here. Below is a perl script to set the user falstaff's
password to testing77 . How can I avoid writing this to disk?
The rest seems to work.
#!/usr/bin/perl -w
# change password for $User to $User_Password
$User = "falstaff" ;
$User_Password = "testing77" ;
open (TEMP,">temp.$$") ;
print TEMP "$User:$User_Password\n" ;
close (TEMP) ;
system("/usr/sbin/chpasswd < temp.$$ ") ;
unlink "temp.$$" ;
> On Fri, Sep 10, 1999 at 08:56:11PM -0700, falstaff@lennon.postino.com wrote:
> >
> > I am trying to setup over 100 users on a RH6 linux box, with passwords.
> > I have a perl script that runs /usr/sbin/adduser to create the users, but
> > I cannot figure out how to create the passwords. Someone suggested using
> > chpasswd to change the passwords, but I cannot figure out how to pipe
> > a list of users & passwords to the command. Any help appreciated.
>
> Well, you can just use cryptpw to generate the password if you are going to
> edit the raw password file, just add the right lines to /etc/passwd and
> /etc/shadow.
>
> Or, if you want to do things in a more kludgy fasion, you can probably just
> pipe it to the command passwd...
>
> passwd username\n
> password\n
> password\n
>
>
> Or, worst comes to worst, you could also try replacing the null password
> given by adduser --disabled-password to the cryptpw output for that user in
> /etc/shadow.
>
> Don't know the most elagent method (well, modifying adduser probably is, but
> if you're not up to that then the next most) but these should work...
>
This archive was generated by hypermail 2.0b3 on Sat 11 Sep 1999 - 05:49:28