Your browser doesn't seem to support CSS, which this page uses for all styling. Don't be surprised if it looks kinda boring.

[Jump to nav]



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.


The latest version is pwd_unmkdb-1.4.tar.xz. This supports the v4 database format used by newer versions of FreeBSD.

Archived versions

  • pwd_unmkdb-1.3.1.tar.gz. silenced harmless compilation warnings (turned into errors by -Werror) that clang gives on 1.3. No other changes.
  • pwd_unmkdb-1.3.tar.gz. fixed some issues caused by fields being wider than expected on 64-bit platforms. Note that it does require a non-ancient version of FreeBSD (at least 5.x I think) to build, so if you're on 4 or earlier (and thus probably on i386 and in no danger of hitting these problems anyway), stick with 1.2 below.
  • pwd_unmkdb-1.2.tar.gz fixed 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.
  • 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.