[BusyBox] how does passwd work

Ihno Krumreich ihno at suse.de
Fri Feb 25 15:56:48 UTC 2005


Hi,

some small correction. The encrypted password in /etc/passwd
is not a md5 sum, but a des encrypted string.

The first two letters are the "salt". This is used two
encrypt the same password in a different way.

So take the firat two characters of the string in /etc/passwd
and the typed in password from the user and pass this to
crypt(3). The result should be the string in /etc/passwd, if
the typed in password is correct.

Have a look at crypt(3) for a detailed explanation.

Ihno

On Fri, Feb 25, 2005 at 04:17:35PM +0000, Florian Fainelli wrote:
> Hi all,
> 
> I would like to know how passwd produces the md5 password wich is in 
> the /etc/passwd file. Examining the passwd.c file did not tell me more about 
> what it is doing.
> 
> I have to write a web interface, and I prefer to calculate the md5 password 
> with javascript, and then write directly the correct /etc/passwd file.
> 
> In fact, the simple implementation of the md5 algorithm does not work, and 
> does not produce the password expected in the /etc/passwd file.
> 
> Has anybody got an idea ? Thanks for your answers.
> 
> Best regards, Florian
> -- 
> Cordialement, Florian
> 
> Association Nantes-Wireless
> www.nantes-wireless.org
> 
> www.alphacore.net



> _______________________________________________
> busybox mailing list
> busybox at mail.busybox.net
> http://busybox.net/mailman/listinfo/busybox


-- 
Best regards/Mit freundlichen Grüßen

Ihno Krumreich

"Never trust a computer you can lift."
--
Ihno Krumreich            ihno at suse.de
SUSE LINUX Products GmbH  Projectmanager S390 & zSeries
Maxfeldstr. 5             +49-911-74053-439
D-90409 Nürnberg          http://www.suse.de



More information about the busybox mailing list