useradd and crypt
David Bandel
david.bandel
Tue Oct 3 16:13:34 PDT 2006
On 10/3/06, Michael Hipp <Michael at hipp.com> wrote:
> I've read numerous HOW-TOs that tell me to add users to my system like this:
>
> useradd -c "Fred Jones" -m -g users -p abc123 fred
>
> But that doesn't do what it appears to do. The '-p' option expects an
> *encrypted* password. If I enter it like above, it puts the plaintext
> "abc123" into /etc/shadow.
>
> The man page says:
>
> -p passwd The encrypted password, as returned by crypt(3)
>
> 'crypt' is a system call - not exactly something you can use from the
> command line.
>
> So if I want to actually enter:
>
> useradd -c "Fred Jones" -m -g users -p $ENCRYPTED fred
>
> What do I use to actually get an encrypted password from "abc123"?
apt-get install makepasswd (debian testing)
(non-debian users will need to use yum and an appropriate repository).
makepasswd is a great utility. I use it to generate passwds for
students when I have to have a couple of hundred.
This utility can generate random passwords, encrypt plaintext
passwords, even provide md5 passwords if you're using md5 (you should)
in your shadow file.
Ciao,
David A. Bandel
--
Focus on the dream, not the competition.
- Nemesis Air Racing Team motto
More information about the Linux-users
mailing list