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

Re: [cobalt-users] Adduser Script



> The problem is going to be getting them entered into the /etc/shadow
file
> with
> the encrypted password. So far the way to do this as I know is to go
to a
> command
> line and enter
>
> passwd username
>
> Then it prompts you to enter new password
> then prompts you to re-type password.
>
> How would one automate that process within this script you sent
> me so that it could take the password and enter these commands
> automatically?

You can specify the password on the adduser line.  It says exactly how
in the man page, but I think its with the -p switch.  The parameter
you give it has to be the encrypted from of the password, as generated
by crypt().  I'm no shell scripting guy, but a bit of Perl to do this
might be:

$cpass = crypt('password');
`adduser username -g 100 -c "User Fullname" -d
/home/sites/home/users/username -p $cpass`;

--
"With $10,000, we'd be millionaires!"
                                           Homer Simpson

Daniel Foster - daniel@xxxxxxxx