The Berkeley DB simple database system came from BSD, and (to use a colourful computing metaphor) BSD has eaten its own dogfood. A lot of what on other systems, and indeed on Unix before BSD, were configuration files with lines of text; are actual binary database files on BSD. This makes them a lot faster to look things up in.
So in many cases if you have edited a system or a per‐user configuration file, that is human‐readable text, you have to do an extra step to turn it into the fast Berkeley DB file that the system expects and actually uses.
Some configuration files are structured like the termcap file was: as a list of (sometimes multiple‐line) records comprising individual capabilities.
These need to be turned into a Berkeley DB file using the cap_mkdb command.
The most obvious example of such a file is the old /etc/termcap file itself, which is turned into /etc/termcap.db, but this has not been a good example for decades, since every BSD apart from FreeBSD has dropped the termcap system in favour of terminfo.
But other capability‐based configuration files include /etc/login.conf and ~/.login_conf.
The user account database, which is searched quite a lot in the normal course of running a Unix or Unix‐like system, is actually two Berkeley DB files.
The /etc/passwd file is not intended to be used and really is just for show, or for very old programs indeed, given that the library functions for reading the user account database date back to 7th Edition AT&T Unix.
The system administrator modifies /etc/master.passwd and that gets turned into Berkeley DB files for everything to use.
/etc/pwd.db is world‐readable and does not contain sensitive data about accounts, and /etc/spwd.db is readable only by the superuser and contains sensitive things like hashed passwords.
Whenever you manually update /etc/master.passwd you need to re‐build these with the pwd_mkdb command.
Operating system tools like NetBSD's useradd or FreeBSD's pw useradd do this automatically.
So does vipw, an older tool that dates from the times when there was just the single BSD.
© Copyright 2026
Jonathan de Boyne Pollard.
"Moral" rights asserted.
Permission is hereby granted to copy and to distribute this web page in its original, unmodified form as long as its last modification datestamp is preserved.