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