xref: /freebsd/usr.sbin/pwd_mkdb/pwd_mkdb.8 (revision daf1cffce2e07931f27c6c6998652e90df6ba87e)
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 ENVIRONMENT
107If the
108.Ev PW_SCAN_BIG_IDS
109environment variable is set,
110.Nm
111will suppress the warning messages that are
112normally generated for large user and group IDs.
113Such IDs can cause serious problems with software
114that makes assumptions about the values of IDs.
115.Sh FILES
116.Bl -tag -width Pa -compact
117.It Pa /etc/pwd.db
118The insecure password database file.
119.It Pa /etc/pwd.db.tmp
120A temporary file.
121.It Pa /etc/spwd.db
122The secure password database file.
123.It Pa /etc/spwd.db.tmp
124A temporary file.
125.It Pa /etc/master.passwd
126The current password file.
127.It Pa /etc/passwd
128A Version 7 format password file.
129.El
130.Sh BUGS
131Because of the necessity for atomic update of the password files,
132.Nm
133uses
134.Xr rename 2
135to install them.
136This, however, requires that the file specified on the command line live
137on the same file system as the
138.Pa /etc
139directory.
140.Pp
141There are the obvious races with multiple people running
142.Nm
143on different password files at the same time.
144The front-ends to
145.Nm pwd_mkdb ,
146.Xr chpass 1 ,
147.Xr passwd 1
148and
149.Xr vipw 8 ,
150handle the locking necessary to avoid this problem.
151.Sh COMPATIBILITY
152Previous versions of the system had a program similar to
153.Nm pwd_mkdb ,
154.Xr mkpasswd 8 ,
155which built
156.Xr dbm 3
157style databases for the password file but depended on the calling programs
158to install them.
159The program was renamed in order that previous users of the program
160not be surprised by the changes in functionality.
161.Sh SEE ALSO
162.Xr chpass 1 ,
163.Xr passwd 1 ,
164.Xr db 3 ,
165.Xr getpwent 3 ,
166.Xr passwd 5 ,
167.Xr vipw 8
168