PWD_MKDB(8)
๐ PWD_MKDB(8) ๐
okay bestie, welcome to pwd_mkdb โ the password-database generator that is, and I cannot stress this enough, living its best retired life on macOS. Buckle in, this one's got lore. ๐
โจ NAME โจ
pwd_mkdb โ generate the password databases ๐ซถ
โจ SYNOPSIS โจ
pwd_mkdb [-ciN] [-p | -s] [-d directory] [-S cachesize] [-u username]
file
like, that's the whole vibe. one file, a handful of flags, zero chill. ๐ธ
โจ DESCRIPTION โจ
so here's the tea: the pwd_mkdb utility serves no purpose in macOS and is included solely for backward compatibility. it's basically the group chat member who's still here from 2011 and we keep them around out of love. ๐ญ
the -c and -p flags โ plus any options that modify the behavior of those flags โ still work. the -s flag has no effect. like, none. it's giving decorative. ๐
see DirectoryService(8) for information on identity management in macOS. that's where the real main character energy lives now. ๐
โจ LEGACY DESCRIPTION โจ
okay so back in the day (and this is the part that still technically runs), the pwd_mkdb utility creates db(3) style secure and insecure databases for the specified file. those databases then get installed into /etc/spwd.db and /etc/pwd.db respectively, and the file itself gets installed into /etc/master.passwd. no cap. ๐ฆ
the file must be in the correct format (see passwd(5)). and it is important to note that the format used in this system is different from the historic Version 7 style format. like, do not mix them up, i'm begging. ๐
the options are as follows:
-cโ check if the password file is in the correct format. that's it. do not change, add, or remove any files. purely a vibe check, no edits. โ-ddirectoryโ store databases into the specified destination directory instead of/etc. pick your own home, icon behavior. ๐-iโ ignore locking failure of themaster.passwdfile. this option is intended to be used to build password files in the release process over NFS where no contention can happen. heads up: a non-default directory must also be specified with the-doption for locking to be ignored, and other use of this option is strongly discouraged. like, i said what i said. โ ๏ธ-Nโ tellpwd_mkdbto exit with an error if it cannot obtain a lock on the file. by default, we block waiting for a lock on the source file โ and the lock is held through the rebuilding of the database. so-Nis the "no, i'm not waiting, bye" flag. ๐ช๐จ-pโ create a Version 7 style password file and install it into/etc/passwd. cannot be used in conjunction with the-sflag. they are literally not friends. ๐ โโ๏ธ-Scachesizeโ specify in megabytes the size of the memory cache used by the hashing library. on systems with a large user base, a small cache size can lead to prohibitively long database file rebuild times. as a rough guide, the memory usage ofpwd_mkdbin megabytes will be a little bit more than twice the figure specified here. the default is 2 megabytes. so like, do the math bestie. ๐งฎ-sโ only update the secure version of the database. most commonly used in conjunction with the-uflag during a password change. because the insecure database doesn't contain the password, there's no reason to update it if the only change is in the password field. cannot be used in conjunction with the-pflag. again: not friends. ๐-uusernameโ only update the record for the specified user. utilities that operate on a single user can use this option to avoid the overhead of rebuilding the entire database. it's giving targeted, efficient, slay. ๐ฏ
the two databases differ in that the secure version contains the user's encrypted password and the insecure version has an asterisk (''*'')
okay so the original sentence literally cuts off right there โ that's not me being mysterious, that's the manpage being mysterious. the asterisk is the whole story and then it justโฆ stops. ๐
the databases are used by the C library password routines (see getpwent(3)). ๐ฅ
the pwd_mkdb utility exits zero on success, non-zero on failure. classic.
โจ ENVIRONMENT โจ
PW_SCAN_BIG_IDSโ if this environment variable is set,pwd_mkdbwill suppress the warning messages that are normally generated for large user and group IDs. such IDs can cause serious problems with software that makes assumptions about the values of IDs. so like, suppressing the warning doesn't fix the problem, bestie, it just mutes the notification. ๐ซฃ
โจ FILES โจ
/etc/pwd.dbโ the insecure password database file./etc/pwd.db.tmpโ a temporary file./etc/spwd.dbโ the secure password database file./etc/spwd.db.tmpโ a temporary file./etc/master.passwdโ the current password file./etc/passwdโ a Version 7 format password file.
look at all these little files living their truth. ๐
โจ EXAMPLES โจ
regenerate the password database after manually editing or replacing the password file:
/usr/sbin/pwd_mkdb -p /etc/master.passwd
that's it. that's the example. iconic. ๐
โจ COMPATIBILITY โจ
previous versions of the system had a program similar to pwd_mkdb called mkpasswd(8), which built dbm(3) style databases for the password file but depended on the calling programs to install them. the program was renamed in order that previous users of the program not be surprised by the changes in functionality. basically they rebranded so nobody would be jumpscared. considerate fr fr. ๐ง
โจ SEE ALSO โจ
chpass(1), passwd(1), db(3), getpwent(3), passwd(5), vipw(8)
go read those, they're all lowkey connected. ๐
โจ BUGS โจ
- because of the necessity for atomic update of the password files,
pwd_mkdbusesrename(2)to install them. this, however, requires that thefilespecified on the command line live on the same file system as the/etcdirectory. cross-device? not happening. ๐ซ - there are the obvious races with multiple people running
pwd_mkdbon different password files at the same time. the front-ends topwd_mkdbโchpass(1),passwd(1)andvipw(8)โ handle the locking necessary to avoid this problem. so like, use the front-ends, they're the responsible ones. ๐
and that's the page!! written by the Debian crew, dated December 20, 2023, filed under PWD_MKDB(8) in the System Manager's Manual. mwah, drink water, back up your /etc. ๐โจ
๐ฆ where this page comes from
- nixpkgs unstable: system_cmds 1042.100.6.0.1
- Copyright (c) 1991, 1993 The Regents of the University of California. All rights reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms