Date: Wed, 12 Nov 2003 14:52:11 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Oles Hnatkevych <ohnatkevych@alfabank.kiev.ua> Cc: freebsd-questions@freebsd.org Subject: Re: md5/des ? Message-ID: <20031112145211.GA22738@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <102687543915.20031112132335@alfabank.kiev.ua> References: <102687543915.20031112132335@alfabank.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
--ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 12, 2003 at 01:23:35PM +0200, Oles Hnatkevych wrote: > /usr/bin/passwd does my passwords MD5 encrypted (accordingly to /etc/logi= n.conf) > But /usr/sbin/adduser creates users with DES encrypted passwords. > How do I make it use MD5 instead of DES? Seems like it's perls crypt() > problem, and the DES is the default... It's not the perl crypt() function, as that just mirrors the behaviour of the underlying libc crypt(3) function. Try these commands and you'll see how things work: Traditional DES: % perl -le 'print crypt("password", "xx")' Extended DES: % perl -le 'print crypt("password", "_xx")' Modular ($1$ =3D> MD5) % perl -le 'print crypt("password", "\$1\$xx")' ie. The format of the salt supplied to crypt controls the algorithm used. You're right however that the adduser(8) command will always generate a DES encrypted password hash. Unfortunately it's programmed so that it can't do anything else -- plus it uses srand() on a combination of the PID, the date and some other data to seed the RNG, which used to be a reasonable idea, but now that we have /dev/random is much less so. Use 'pw useradd' command instead. See pw(8) -- this is a much more capable program for manipulating user and group accounts, and it doesn't suffer from the drawbacks you've noted. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --ikeVEW9yuYc//A+q Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/skkbdtESqEQa7a0RAipxAJ9Bui/PiQ4G1trD74Ta5kInxOeE5wCeKO6W /1Ut2JkQJbQBJGCjK/ZmsEw= =Ere7 -----END PGP SIGNATURE----- --ikeVEW9yuYc//A+q--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031112145211.GA22738>