Red Hat Bugzilla – Bug 7660
useradd -p enters plain text password
Last modified: 2008-05-01 11:37:53 EDT
When using the -p command line switch with useradd a plain text password is
added in /etc/passwd or /etc/shadow and not an encrypted password. After
using useradd a user connot log in with the password supplied to useradd,
the passwd command has to be run to update the passwd properly.
useradd -p takes the *encrypted* password as parameter.
Allowing to specify cleartext passwords in the command line would not be a very
good idea (anyone can read it, and it remains in .bash_history).
If you absolutely need that function, use something along the lines of
useradd -p `echo 'print crypt("password", "RH");' | perl` username