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