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

Re: Auto password assignment



Ian Melnick wrote:
> 
> I have a script for generating certain types of user accounts for my
> network. I want to assign random initial passwords to every new user,
> that they can change on their own later. I decided to generate them with
> makepasswd. The question is, how can I tell passwd to use this password
> for the new user without manually typing it in? Is there a way I can
> script it?

I have not given this too much thought.  So take this as brainstorming
and not really an answer.

Have the adduser command build the account initially disabled.  Use
'adduser --disabled-password' to do that.

Use a perl script to take the plain text password and convert it to
the encrypted text string.  I don't know of a command that does that
directly.  But you can build it up in perl quite easily.

Use 'usermod -p string user' to update the account information in
/etc/shadow (or /etc/passwd if you are doing it the old way) with the
prebuilt string.

Bob

Attachment: pgpjp6nfYQJK5.pgp
Description: PGP signature


Reply to: