[TriLUG] back on topic... MD5 passwords for adding users ?

Donald Ball balld at webslingerZ.com
Fri Sep 7 17:03:30 EDT 2001


On Fri, 7 Sep 2001 jeremyp at pobox.com wrote:

> Hi all,
>
> I'm looking to find some documentation on how MD5 passwords work in
> Linux.  Specifically, I'm trying to write a perl script to add
> users, with passwords that I generate.  I figured the easiest way to do
> this is to feed stuff to "useradd", and let useradd do the dirty work, but
> useradd will only take encrypted passwords.  Its man page says this:
>
>        -p passwd
>               The  encrypted password, as returned by crypt(3) or
>               an MD5 password generator.  The default is to  dis-
>               able the account.
>
> I need the "MD5 password generator" that it's referring to!  I've seen
> some comments that crypt(3) in Linux can handle MD5 passwords, but
> there is no documentation in "man 3 crypt" on this, and I feel I'd be
> reinventing the wheel anyway to write a C program to do this.
>
> I've googled quite a bit and can't find anything useful ... thanks for any
> insight!

doesn't the crypt() function do md5 'encryption' if the magic $1$ string
is the first part of the salt string?

http://www.gnu.org/manual/glibc-2.2.3/html_chapter/libc_32.html

- donald




More information about the TriLUG mailing list