xref: /freebsd/usr.sbin/pwd_mkdb/pwd_mkdb.8 (revision d37ea99837e6ad50837fd9fe1771ddf1c3ba6002)
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
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
51The
52.Nm
53utility creates
54.Xr db 3
55style secure and insecure databases for the specified file.
56These databases are then installed into
57.Pa /etc/spwd.db
58and
59.Pa /etc/pwd.db
60respectively.
61The file is installed into
62.Pa /etc/master.passwd .
63The file must be in the correct format (see
64.Xr passwd 5 ) .
65It is important to note that the format used in this system is
66different from the historic Version 7 style format.
67.Pp
68The options are as follows:
69.Bl -tag -width flag
70.It Fl C
71Check if the password file is in the correct format.
72Do not
73change, add, or remove any files.
74.It Fl N
75Tell
76.Nm
77to exit with an error if it cannot obtain a lock on the file.  By default,
78we block waiting for a lock on the source file.  The lock is held through
79the rebuilding of the database.
80.It Fl p
81Create a Version 7 style password file and install it into
82.Pa /etc/passwd .
83.It Fl d Ar directory
84Store databases into specified destination directory instead of
85.Pa /etc .
86.It Fl u Ar username
87Only update the record for the specified user.  Utilities that
88operate on a single user can use this option to avoid the
89overhead of rebuilding the entire database.
90.It Fl s Ar cachesize
91Specify in megabytes the size of the memory cache used by the
92hashing library.  On systems with a large user base, a small cache
93size can lead to prohibitively long database file rebuild times.
94As a rough guide, the memory usage of
95.Nm
96in megabytes will be a little bit more than twice the figure
97specified here.  The default is 2 megabytes.
98.El
99.Pp
100The two databases differ in that the secure version contains the user's
101encrypted password and the insecure version has an asterisk (``*'')
102.Pp
103The databases are used by the C library password routines (see
104.Xr getpwent 3 ) .
105.Pp
106The
107.Nm
108utility exits zero on success, non-zero on failure.
109.Sh ENVIRONMENT
110If the
111.Ev PW_SCAN_BIG_IDS
112environment variable is set,
113.Nm
114will suppress the warning messages that are
115normally generated for large user and group IDs.
116Such IDs can cause serious problems with software
117that makes assumptions about the values of IDs.
118.Sh FILES
119.Bl -tag -width Pa -compact
120.It Pa /etc/pwd.db
121The insecure password database file.
122.It Pa /etc/pwd.db.tmp
123A temporary file.
124.It Pa /etc/spwd.db
125The secure password database file.
126.It Pa /etc/spwd.db.tmp
127A temporary file.
128.It Pa /etc/master.passwd
129The current password file.
130.It Pa /etc/passwd
131A Version 7 format password file.
132.El
133.Sh BUGS
134Because of the necessity for atomic update of the password files,
135.Nm
136uses
137.Xr rename 2
138to install them.
139This, however, requires that the file specified on the command line live
140on the same file system as the
141.Pa /etc
142directory.
143.Pp
144There are the obvious races with multiple people running
145.Nm
146on different password files at the same time.
147The front-ends to
148.Nm ,
149.Xr chpass 1 ,
150.Xr passwd 1
151and
152.Xr vipw 8 ,
153handle the locking necessary to avoid this problem.
154.Sh COMPATIBILITY
155Previous versions of the system had a program similar to
156.Nm ,
157.Xr mkpasswd 8 ,
158which built
159.Xr dbm 3
160style databases for the password file but depended on the calling programs
161to install them.
162The program was renamed in order that previous users of the program
163not be surprised by the changes in functionality.
164.Sh SEE ALSO
165.Xr chpass 1 ,
166.Xr passwd 1 ,
167.Xr db 3 ,
168.Xr getpwent 3 ,
169.Xr passwd 5 ,
170.Xr vipw 8
171