]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/pwd_mkdb/pwd_mkdb.8
genl: add a monitor subcommand
[FreeBSD/FreeBSD.git] / usr.sbin / pwd_mkdb / pwd_mkdb.8
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 .\"
30 .Dd March 25, 2023
31 .Dt PWD_MKDB 8
32 .Os
33 .Sh NAME
34 .Nm pwd_mkdb
35 .Nd "generate the password databases"
36 .Sh SYNOPSIS
37 .Nm
38 .Op Fl CiNp
39 .Op Fl d Ar directory
40 .Op Fl s Ar cachesize
41 .Op Fl u Ar username
42 .Ar file
43 .Sh DESCRIPTION
44 The
45 .Nm
46 utility creates
47 .Xr db 3
48 style secure and insecure databases for the specified file.
49 These databases are then installed into
50 .Pa /etc/spwd.db
51 and
52 .Pa /etc/pwd.db
53 respectively.
54 The file is installed into
55 .Pa /etc/master.passwd .
56 The file must be in the correct format (see
57 .Xr passwd 5 ) .
58 It is important to note that the format used in this system is
59 different from the historic Version 7 style format.
60 .Pp
61 The options are as follows:
62 .Bl -tag -width flag
63 .It Fl C
64 Check if the password file is in the correct format.
65 Do not
66 change, add, or remove any files.
67 .It Fl d Ar directory
68 Store databases into specified destination directory instead of
69 .Pa /etc .
70 .It Fl i
71 Ignore locking failure of the
72 .Pa master.passwd
73 file.
74 This option is intended to be used to build password files in
75 the release process over NFS where no contention can happen.
76 A non-default directory must also be specified with the
77 .Fl d
78 option for locking to be ignored.
79 Other use of this option is strongly discouraged.
80 .It Fl N
81 Tell
82 .Nm
83 to exit with an error if it cannot obtain a lock on the file.
84 By default,
85 we block waiting for a lock on the source file.
86 The lock is held through
87 the rebuilding of the database.
88 .It Fl p
89 Create a Version 7 style password file and install it into
90 .Pa /etc/passwd .
91 .It Fl s Ar cachesize
92 Specify in megabytes the size of the memory cache used by the
93 hashing library.
94 On systems with a large user base, a small cache
95 size can lead to prohibitively long database file rebuild times.
96 As a rough guide, the memory usage of
97 .Nm
98 in megabytes will be a little bit more than twice the figure
99 specified here.
100 The default is 2 megabytes.
101 .It Fl u Ar username
102 Only update the record for the specified user.
103 Utilities that
104 operate on a single user can use this option to avoid the
105 overhead of rebuilding the entire database.
106 .El
107 .Pp
108 The two databases differ in that the secure version contains the user's
109 encrypted password and the insecure version has an asterisk (``*'')
110 .Pp
111 The databases are used by the C library password routines (see
112 .Xr getpwent 3 ) .
113 .Pp
114 The
115 .Nm
116 utility exits zero on success, non-zero on failure.
117 .Sh ENVIRONMENT
118 If the
119 .Ev PW_SCAN_BIG_IDS
120 environment variable is set,
121 .Nm
122 will suppress the warning messages that are
123 normally generated for large user and group IDs.
124 Such IDs can cause serious problems with software
125 that makes assumptions about the values of IDs.
126 .Sh FILES
127 .Bl -tag -width Pa -compact
128 .It Pa /etc/pwd.db
129 The insecure password database file.
130 .It Pa /etc/pwd.db.tmp
131 A temporary file.
132 .It Pa /etc/spwd.db
133 The secure password database file.
134 .It Pa /etc/spwd.db.tmp
135 A temporary file.
136 .It Pa /etc/master.passwd
137 The current password file.
138 .It Pa /etc/passwd
139 A Version 7 format password file.
140 .El
141 .Sh EXAMPLES
142 Regenerate the password database after manually editing or replacing
143 the password file:
144 .Bd -literal -offset -indent
145 /usr/sbin/pwd_mkdb -p /etc/master.passwd
146 .Ed
147 .Sh COMPATIBILITY
148 Previous versions of the system had a program similar to
149 .Nm ,
150 .Xr mkpasswd 8 ,
151 which built
152 .Xr dbm 3
153 style databases for the password file but depended on the calling programs
154 to install them.
155 The program was renamed in order that previous users of the program
156 not 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
165 Because of the necessity for atomic update of the password files,
166 .Nm
167 uses
168 .Xr rename 2
169 to install them.
170 This, however, requires that the file specified on the command line live
171 on the same file system as the
172 .Pa /etc
173 directory.
174 .Pp
175 There are the obvious races with multiple people running
176 .Nm
177 on different password files at the same time.
178 The front-ends to
179 .Nm ,
180 .Xr chpass 1 ,
181 .Xr passwd 1
182 and
183 .Xr vipw 8 ,
184 handle the locking necessary to avoid this problem.