1.\" Copyright (c) 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. Neither the name of the University nor the names of its contributors 13.\" may be used to endorse or promote products derived from this software 14.\" without specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93 29.\" $FreeBSD: src/usr.sbin/pwd_mkdb/pwd_mkdb.8,v 1.26 2005/02/28 21:05:30 ru Exp $ 30.\" $DragonFly: src/usr.sbin/pwd_mkdb/pwd_mkdb.8,v 1.3 2006/02/17 19:40:22 swildner Exp $ 31.\" 32.Dd February 28, 2005 33.Dt PWD_MKDB 8 34.Os 35.Sh NAME 36.Nm pwd_mkdb 37.Nd "generate the password databases" 38.Sh SYNOPSIS 39.Nm 40.Op Fl BCiLNp 41.Op Fl d Ar directory 42.Op Fl s Ar cachesize 43.Op Fl u Ar username 44.Ar file 45.Sh DESCRIPTION 46The 47.Nm 48utility creates 49.Xr db 3 50style secure and insecure databases for the specified file. 51These databases are then installed into 52.Pa /etc/spwd.db 53and 54.Pa /etc/pwd.db 55respectively. 56The file is installed into 57.Pa /etc/master.passwd . 58The file must be in the correct format (see 59.Xr passwd 5 ) . 60It is important to note that the format used in this system is 61different from the historic Version 7 style format. 62.Pp 63The options are as follows: 64.Bl -tag -width flag 65.It Fl B 66Store data in big-endian format. 67.It Fl C 68Check if the password file is in the correct format. 69Do not 70change, add, or remove any files. 71.It Fl L 72Store data in little-endian format. 73.It Fl N 74Tell 75.Nm 76to exit with an error if it cannot obtain a lock on the file. 77By default, 78we block waiting for a lock on the source file. 79The lock is held through 80the rebuilding of the database. 81.It Fl p 82Create a Version 7 style password file and install it into 83.Pa /etc/passwd . 84.It Fl i 85Ignore locking failure of the 86.Pa master.passwd 87file. 88This option is intended to be used to build password files in 89the release process over NFS where no contention can happen. 90A non-default directory must also be specified with the 91.Fl d 92option for locking to be ignored. 93Other use of this option is strongly discouraged. 94.It Fl d Ar directory 95Store databases into specified destination directory instead of 96.Pa /etc . 97.It Fl u Ar username 98Only update the record for the specified user. 99Utilities that 100operate on a single user can use this option to avoid the 101overhead of rebuilding the entire database. 102.It Fl s Ar cachesize 103Specify in megabytes the size of the memory cache used by the 104hashing library. 105On systems with a large user base, a small cache 106size can lead to prohibitively long database file rebuild times. 107As a rough guide, the memory usage of 108.Nm 109in megabytes will be a little bit more than twice the figure 110specified here. 111The default is 2 megabytes. 112.El 113.Pp 114The two databases differ in that the secure version contains the user's 115encrypted password and the insecure version has an asterisk (``*'') 116.Pp 117The databases are used by the C library password routines (see 118.Xr getpwent 3 ) . 119.Pp 120The 121.Nm 122utility exits zero on success, non-zero on failure. 123.Sh ENVIRONMENT 124If the 125.Ev PW_SCAN_BIG_IDS 126environment variable is set, 127.Nm 128will suppress the warning messages that are 129normally generated for large user and group IDs. 130Such IDs can cause serious problems with software 131that makes assumptions about the values of IDs. 132.Sh FILES 133.Bl -tag -width Pa -compact 134.It Pa /etc/pwd.db 135The insecure password database file. 136.It Pa /etc/pwd.db.tmp 137A temporary file. 138.It Pa /etc/spwd.db 139The secure password database file. 140.It Pa /etc/spwd.db.tmp 141A temporary file. 142.It Pa /etc/master.passwd 143The current password file. 144.It Pa /etc/passwd 145A Version 7 format password file. 146.El 147.Sh COMPATIBILITY 148Previous versions of the system had a program similar to 149.Nm , 150.Xr mkpasswd 8 , 151which built 152.Xr dbm 3 153style databases for the password file but depended on the calling programs 154to install them. 155The program was renamed in order that previous users of the program 156not be surprised by the changes in functionality. 157.Sh SEE ALSO 158.Xr chpass 1 , 159.Xr passwd 1 , 160.Xr db 3 , 161.Xr getpwent 3 , 162.Xr passwd 5 , 163.Xr vipw 8 164.Sh BUGS 165Because of the necessity for atomic update of the password files, 166.Nm 167uses 168.Xr rename 2 169to install them. 170This, however, requires that the file specified on the command line live 171on the same file system as the 172.Pa /etc 173directory. 174.Pp 175There are the obvious races with multiple people running 176.Nm 177on different password files at the same time. 178The front-ends to 179.Nm , 180.Xr chpass 1 , 181.Xr passwd 1 182and 183.Xr vipw 8 , 184handle the locking necessary to avoid this problem. 185