----- Original Message ----- From: "Gene Grimm" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, May 17, 2002 10:42 AM Subject: Re: Setting user passwords non-interactively
> > i think chpasswd is what your looking for. > > chpasswd user:pass > > > > on woody atleast its included in the passwd package > > > > > im wondering if there is any non-interactive way to set a user's > > > password.......i need to do it through a script....please > > Actually, I use Perl script with a shell system call to 'usermod' or > 'useradd' with the '-p' option, however you have to remember to crypt the > password - crypt($passwd,$seed) - in the Perl script. I used this in a perl script to set up a temp user on a system and set the password for it: $groupadd="groupadd $tempuser"; system("$groupadd\n"); $syscall = "useradd -m -c \"$firstname $lastname,,,\($ac\)$phone\" -e \"$datef\" -g $tempuser $tempuser"; system("$syscall"); $chngpasswd= "echo $tempuser\:$password|chpasswd"; system("$chngpasswd\n"); works great.... Richard -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]