Using Linux DES Passwords On A FreeBSD System
These aren't comprehensive notes for migrating from Linux to FreeBSD. (Not yet, anyway.) They document a specific problem I needed to solve: using hashed DES passwords generated on a Linux 2.0.30 system on a FreeBSD 4.4-RELEASE #0 system, which is set up to use passwords hashed with MD5. I hope this helps someone else. Note that the same procedure probably applies if you need to use passwords from an oldish BSD system on a newish BSD system, but YMMV.
- By default, newish FreeBSD releases hash their passwords with MD5, while oldish Linux releases used DES.
- Start by telling the FreeBSD system to use DES for the appropriate users by creating a des_users login class. In my case, as simple as uncommenting the following in /etc/login.conf:
des_users:\
:password_format=des:\
:tc=default:
- Regenerate /etc/login.conf.db to make the changes effective:
cap_mkdb /etc/login.conf
- Edit the user's entry in /etc/master.passwd to include them in the new login class. You can do this from the command line with the nifty pw utility:
pw usermod -n yourusernamehere -L des_users
- Copy the hashed password for the user in question from /etc/shadow on the Linux system (maybe /etc/passwd on your system).
- Paste the hashed password into the appropriate field in /etc/master.passwd on the FreeBSD system.
- Use pwd_mkdb to regenerate the pwd.db and spwd.db databases (where the system calls actually look for password stuff) on the BSD system. (I'd back up my passwd files first...) Probably as simple as this:
pwd_mkdb /etc/master.passwd
- Bob's your uncle!
Copyright 2004 Szarka Networks.
This work is licensed under a Creative Commons License.