makeuserdb pw2userdb
This command creates binary database file, /etc/userdb.dat, based on the contents of /etc/userdb. /etc/userdb.dat is used by maildrop and Courier as either a substitute for your system password file, or as a complement to your system password file. It is possible to use /etc/userdb.dat to specify "virtual" accounts, accounts that do not have an associated login. Typically all virtual accounts share the same system userid. /etc/userdb.dat can also be used as a substitute for your system password file. Because the system password file is a text file, when there's a large number of accounts it will be significantly faster to search a binary database file, instead of a text file.
The makeuserdb command creates /etc/userdb.dat based on the contents of /etc/userdb. This can be either a plain text file, or a directory. If it is a directory, the contents of all the files in the directory are combined into one file, before being used to create /etc/userdb.dat.
makeuserdb command can be safely executed during normal system operations.
name<TAB>field=value|field=value
name is the account name. If Courier is configured to treat lowercase and uppercase account names as identical, name MUST contain lowercase characters only. name is followed by exactly one tab character, then a list of field/value pairs separated by vertical slash characters. field is the name of the field, value is the field value. The field value itself cannot contain commas. Fields can be specified in any order. Here are the currently defined fields. Note that not every field is used by every application that uses /etc/userdb.dat.
The uid, gid, and home fields MUST be specified.
The remaining fields are optional. If missing, system defaults will be
used.
=uid<TAB>name
This entry is used to specify reverse mapping from userids to names. uid specifies the UNIX userid, name specifies the UNIX username. name must point to another record in userdb.
All fields whose name ends with 'pw' will NOT copied to /etc/userdb.dat. These fields will be copied to /etc/userdbshadow.dat. makeuserdb will turn off all group and world permissions on /etc/userdbshadow.dat. makeuserdb will also fail if /etc/userdb has any group or world permissions.
The pw2userdb script reads /etc/passwd and /etc/shadow and converts all accounts to /etc/userdb format, printing the result on standard output. The output can be redirected to /etc/userdb, or to a file in this subdirectory. Linerar searches of /etc/passwd can be very slow when you have tens of thousands of accounts. Programs like maildrop always look in /etc/userdb first, so by having the system password file in the /etc/userdb it is possible to significantly reduce the amount of time it takes to look it up.
After saving the output of pw2userdb, you must still run makeuserdb to convert it to a binary database format.
No errors will be reported if the same account name appears more than once.
systempw and pop3pw must be encrypted via crypt.
makeuserdb is a Perl script, and uses Perl's portable locking. Perl's documentation notes that certain combinations of locking options may not work with some networks.
userdb(8), maildrop(1), courier(1), maildirquota(8)