| PWD_MKDB(8) | System Manager's Manual | PWD_MKDB(8) | 
pwd_mkdb —
| pwd_mkdb | [ -BLlpsvw] [-ccachesize] [-ddirectory] [-uusername] [-Vversion] file | 
pwd_mkdb creates
  db(3) style secure and insecure
  databases for the specified file. These databases are then installed into
  “/etc/spwd.db” and
  “/etc/pwd.db” respectively. The file is
  installed into “/etc/master.passwd”. The
  file must be in the correct format (see
  passwd(5)). It is important to
  note that the format used in this system is different from the historic
  Version 7 style format.
The options are as follows:
-B-L).-c
    cachesizepwd_mkdb in megabytes will be a
      little bit more than twice the figure specified here. If unspecified, this
      value will be calculated based on the size of the input file up to a
      maximum of 8 megabytes.-d
    directory-L-B).-l-p-s-p option.-u
    name-V
    version0 is the old format (up to and including
      NetBSD 5.0) with the 4 byte time fields and
      version 1 is the new format with the 8 byte time
      fields (greater than NetBSD 5.0).
      NetBSD 5.0 cannot read version
      1 databases. All versions above
      NetBSD 5.0 can read and write both version
      0 and version 1 databases.
      By default the databases stay in the version they were before the command
      was run.-v-wThe two databases differ in that the secure version contains the user's encrypted password and the insecure version has an asterisk (“*”).
The databases are used by the C library password routines (see getpwent(3)).
pwd_mkdb exits zero on success, non-zero on failure.
pwd_mkdb which built dbm 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.
pwd_mkdb uses
  rename(2) to install them. This,
  however, requires that the file specified on the command line live on the same
  file system as the “/etc” directory.
There are the obvious races with multiple people running
    pwd_mkdb on different password files at the same
    time. The front-ends to
    chpass(1),
    passwd(1),
    useradd(8),
    userdel(8),
    usermod(8), and
    vipw(8) handle the locking
    necessary to avoid this problem.
The database files are copied when the -u
    option is used. Real locking would make this unnecessary.
Although the DB format is endian-transparent, the data stored in the DB is not. Also, the format doesn't lend itself to insertion or removal of records from arbitrary locations in the password file. This is difficult to fix without breaking compatibility.
Using the -u option on a system where
    multiple users share the same UID can have unexpected results.
| August 18, 2010 | NetBSD 10.1 |