[TriLUG] automatically generating an encrypted passwd for useradd -p for RHEL

Chip Turner cturner at pattern.net
Tue Dec 2 12:39:26 EST 2003


Marvin Blackburn <mblackburn at glenraven.com> writes:

> I need a method for automatically generating a crypt(3) password so I can
> input it into the
> usermod -p command to force a user to enter a new password when logging in.
> 
> I saw a way to use python to generate the key, but its not automatated.
> 
> Any help would be appreciated.
> I am running RHEL ES2.1

For md5 passwords (almost certainly what you always want for user accounts):
openssl passwd -1

For true old fashioned, insecure crypt passwords that you almost never
should use unless you really really know why you need them:
openssl passwd -crypt

Both will prompt you for the password twice, compute a random salt,
and spit out the encrypted password.  Check 'man sslpasswd' for
details.

Chip

-- 
Chip Turner                   cturner at pattern.net



More information about the TriLUG mailing list