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. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93 33.\" $FreeBSD$ 34.\" 35.Dd June 6, 1993 36.Dt PWD_MKDB 8 37.Os 38.Sh NAME 39.Nm pwd_mkdb 40.Nd "generate the password databases" 41.Sh SYNOPSIS 42.Nm pwd_mkdb 43.Op Fl C 44.Op Fl N 45.Op Fl p 46.Op Fl d Ar directory 47.Op Fl s Ar cachesize 48.Op Fl u Ar username 49.Ar file 50.Sh DESCRIPTION 51.Nm Pwd_mkdb 52creates 53.Xr db 3 54style secure and insecure databases for the specified file. 55These databases are then installed into 56.Pa /etc/spwd.db 57and 58.Pa /etc/pwd.db 59respectively. 60The file is installed into 61.Pa /etc/master.passwd . 62The file must be in the correct format (see 63.Xr passwd 5 ) . 64It is important to note that the format used in this system is 65different from the historic Version 7 style format. 66.Pp 67The options are as follows: 68.Bl -tag -width flag 69.It Fl C 70Check if the password file is in the correct format. Do not 71change, add, or remove any files. 72.It Fl N 73Tell 74.Nm Pwd_mkdb 75to exit with an error if it cannot obtain a lock on the file. By default, 76we block waiting for a lock on the source file. The lock is held through 77the rebuilding of the database. 78.It Fl p 79Create a Version 7 style password file and install it into 80.Pa /etc/passwd . 81.It Fl d Ar directory 82Store databases into specified destination directory instead of 83.Pa /etc . 84.It Fl u Ar username 85Only update the record for the specified user. Utilities that 86operate on a single user can use this option to avoid the 87overhead of rebuilding the entire database. 88.It Fl s Ar cachesize 89Specify in megabytes the size of the memory cache used by the 90hashing library. On systems with a large user base, a small cache 91size can lead to prohibitively long database file rebuild times. 92As a rough guide, the memory usage of 93.Nm pwd_mkdb 94in megabytes will be a little bit more than twice the figure 95specified here. The default is 2 megabytes. 96.El 97.Pp 98The two databases differ in that the secure version contains the user's 99encrypted password and the insecure version has an asterisk (``*'') 100.Pp 101The databases are used by the C library password routines (see 102.Xr getpwent 3 ) . 103.Pp 104.Nm Pwd_mkdb 105exits zero on success, non-zero on failure. 106.Sh FILES 107.Bl -tag -width Pa -compact 108.It Pa /etc/pwd.db 109The insecure password database file. 110.It Pa /etc/pwd.db.tmp 111A temporary file. 112.It Pa /etc/spwd.db 113The secure password database file. 114.It Pa /etc/spwd.db.tmp 115A temporary file. 116.It Pa /etc/master.passwd 117The current password file. 118.It Pa /etc/passwd 119A Version 7 format password file. 120.El 121.Sh BUGS 122Because of the necessity for atomic update of the password files, 123.Nm 124uses 125.Xr rename 2 126to install them. 127This, however, requires that the file specified on the command line live 128on the same file system as the 129.Pa /etc 130directory. 131.Pp 132There are the obvious races with multiple people running 133.Nm 134on different password files at the same time. 135The front-ends to 136.Nm pwd_mkdb , 137.Xr chpass 1 , 138.Xr passwd 1 139and 140.Xr vipw 8 , 141handle the locking necessary to avoid this problem. 142.Sh COMPATIBILITY 143Previous versions of the system had a program similar to 144.Nm pwd_mkdb , 145.Xr mkpasswd 8 , 146which built 147.Xr dbm 3 148style databases for the password file but depended on the calling programs 149to install them. 150The program was renamed in order that previous users of the program 151not be surprised by the changes in functionality. 152.Sh SEE ALSO 153.Xr chpass 1 , 154.Xr passwd 1 , 155.Xr db 3 , 156.Xr getpwent 3 , 157.Xr passwd 5 , 158.Xr vipw 8 159