This page uses CSS for all styling, which your browser doesn't support. This page will look pretty bland, but you'll still be able to read every word.

pwd_unmkdb

Summary

pwd_unmkdb is a C program I tossed together in about an hour and a half. I'd been thinking about it for a while, so I decided to investigate quickly how difficult it would be before I went to bed. Next thing I know, it was done :)

It's designed to read a FreeBSD /etc/spwd.db file (which is created from /etc/master.passwd by pwd_mkdb(8)), and re-create the master.passwd file it was created from. I've waxed my master.passwd a number of times, either by careless rm'ing, the occasional hard drive going bad, and more than once by being careless while mergemaster(8)'ing. Of course, things keep going because the spwd.db file is still there, which is what everything uses to work off of. But you can't edit the DB file, or add users to it, or the like. You need the normal, flat, human-readable master.passwd for that. This program lets you recover exactly what the system is currently using, but in a form that you can use.

How to use it

Download and untar. Make. Run it with a 'spwd.db' file in that directory, and watch it make a 'master.passwd' from it. Or, use the '-i' arg to specify a different input file, and the '-o' arg to specify a different output file. See the manpage (included) for details.

There is no 'install' target in the Makefile to install the binary/manpage anywhere on your system. That's semi-intentional; if you want it somewhere, stick it somewhere.

Download

The latest version is pwd_unmkdb-1.2.tar.gz. This fixes a bug in the code which, I think, wouldn't have caused any problems (since it deal with initialization of a variable we don't use), but could cause compile-time errors, particulary on 64-bit platforms.

Archived versions

  • pwd_unmkdb-1.1.tar.gz made some minor changes to the build process, to make it pay slightly more attention to your system defaults. There's no functional changes.
  • pwd_unmkdb-1.0.tar.gz is the original version.

Share and enjoy.