1994-05-26 05:23:31 +00:00
|
|
|
.\" Copyright (c) 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2017-02-28 23:42:47 +00:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1994-05-26 05:23:31 +00:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93
|
1999-08-28 01:35:59 +00:00
|
|
|
.\" $FreeBSD$
|
1994-05-26 05:23:31 +00:00
|
|
|
.\"
|
2018-05-01 00:53:46 +00:00
|
|
|
.Dd April 30, 2018
|
1994-05-26 05:23:31 +00:00
|
|
|
.Dt PWD_MKDB 8
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm pwd_mkdb
|
|
|
|
.Nd "generate the password databases"
|
|
|
|
.Sh SYNOPSIS
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm
|
2018-05-01 00:53:46 +00:00
|
|
|
.Op Fl BCiLNp
|
1994-09-07 22:54:00 +00:00
|
|
|
.Op Fl d Ar directory
|
1998-04-19 07:15:34 +00:00
|
|
|
.Op Fl s Ar cachesize
|
1997-04-04 00:49:35 +00:00
|
|
|
.Op Fl u Ar username
|
1994-05-26 05:23:31 +00:00
|
|
|
.Ar file
|
|
|
|
.Sh DESCRIPTION
|
2002-07-14 14:47:15 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility creates
|
1994-05-26 05:23:31 +00:00
|
|
|
.Xr db 3
|
|
|
|
style secure and insecure databases for the specified file.
|
|
|
|
These databases are then installed into
|
1997-10-10 06:27:07 +00:00
|
|
|
.Pa /etc/spwd.db
|
1994-05-26 05:23:31 +00:00
|
|
|
and
|
1997-10-10 06:27:07 +00:00
|
|
|
.Pa /etc/pwd.db
|
1994-05-26 05:23:31 +00:00
|
|
|
respectively.
|
|
|
|
The file is installed into
|
1997-10-10 06:27:07 +00:00
|
|
|
.Pa /etc/master.passwd .
|
1994-05-26 05:23:31 +00:00
|
|
|
The file must be in the correct format (see
|
|
|
|
.Xr passwd 5 ) .
|
|
|
|
It is important to note that the format used in this system is
|
|
|
|
different from the historic Version 7 style format.
|
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width flag
|
1998-01-10 17:27:28 +00:00
|
|
|
.It Fl C
|
2000-03-01 14:09:25 +00:00
|
|
|
Check if the password file is in the correct format.
|
|
|
|
Do not
|
1996-08-19 16:03:15 +00:00
|
|
|
change, add, or remove any files.
|
1998-12-13 01:53:50 +00:00
|
|
|
.It Fl N
|
|
|
|
Tell
|
2001-08-04 22:11:08 +00:00
|
|
|
.Nm
|
2004-07-02 23:13:00 +00:00
|
|
|
to exit with an error if it cannot obtain a lock on the file.
|
|
|
|
By default,
|
|
|
|
we block waiting for a lock on the source file.
|
|
|
|
The lock is held through
|
1998-12-13 01:53:50 +00:00
|
|
|
the rebuilding of the database.
|
1994-05-26 05:23:31 +00:00
|
|
|
.It Fl p
|
|
|
|
Create a Version 7 style password file and install it into
|
1997-10-10 06:27:07 +00:00
|
|
|
.Pa /etc/passwd .
|
2004-07-21 17:38:04 +00:00
|
|
|
.It Fl i
|
|
|
|
Ignore locking failure of the
|
|
|
|
.Pa master.passwd
|
|
|
|
file.
|
|
|
|
This option is intended to be used to build password files in
|
|
|
|
the release process over NFS where no contention can happen.
|
|
|
|
A non-default directory must also be specified with the
|
|
|
|
.Fl d
|
|
|
|
option for locking to be ignored.
|
|
|
|
Other use of this option is strongly discouraged.
|
1997-04-04 00:49:35 +00:00
|
|
|
.It Fl d Ar directory
|
1994-09-07 22:54:00 +00:00
|
|
|
Store databases into specified destination directory instead of
|
1997-10-10 06:27:07 +00:00
|
|
|
.Pa /etc .
|
1997-04-04 00:49:35 +00:00
|
|
|
.It Fl u Ar username
|
2004-07-02 23:13:00 +00:00
|
|
|
Only update the record for the specified user.
|
|
|
|
Utilities that
|
1997-04-04 00:49:35 +00:00
|
|
|
operate on a single user can use this option to avoid the
|
|
|
|
overhead of rebuilding the entire database.
|
1998-04-19 07:15:34 +00:00
|
|
|
.It Fl s Ar cachesize
|
|
|
|
Specify in megabytes the size of the memory cache used by the
|
2004-07-02 23:13:00 +00:00
|
|
|
hashing library.
|
|
|
|
On systems with a large user base, a small cache
|
1998-04-19 07:15:34 +00:00
|
|
|
size can lead to prohibitively long database file rebuild times.
|
|
|
|
As a rough guide, the memory usage of
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm
|
1998-04-19 07:15:34 +00:00
|
|
|
in megabytes will be a little bit more than twice the figure
|
2004-07-02 23:13:00 +00:00
|
|
|
specified here.
|
|
|
|
The default is 2 megabytes.
|
1994-05-26 05:23:31 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2001-07-15 08:06:20 +00:00
|
|
|
The two databases differ in that the secure version contains the user's
|
1994-05-26 05:23:31 +00:00
|
|
|
encrypted password and the insecure version has an asterisk (``*'')
|
|
|
|
.Pp
|
|
|
|
The databases are used by the C library password routines (see
|
|
|
|
.Xr getpwent 3 ) .
|
|
|
|
.Pp
|
2018-05-01 00:53:46 +00:00
|
|
|
The following options affected the generation of legacy entries,
|
|
|
|
and are now deprecated.
|
2015-06-04 07:24:56 +00:00
|
|
|
.Bl -tag -width flag
|
|
|
|
.It Fl B
|
|
|
|
Store data in big-endian format.
|
|
|
|
.It Fl L
|
|
|
|
Store data in little-endian format.
|
|
|
|
.El
|
|
|
|
.Pp
|
2002-07-14 14:47:15 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility exits zero on success, non-zero on failure.
|
1999-12-02 16:39:15 +00:00
|
|
|
.Sh ENVIRONMENT
|
|
|
|
If the
|
|
|
|
.Ev PW_SCAN_BIG_IDS
|
|
|
|
environment variable is set,
|
|
|
|
.Nm
|
|
|
|
will suppress the warning messages that are
|
|
|
|
normally generated for large user and group IDs.
|
|
|
|
Such IDs can cause serious problems with software
|
|
|
|
that makes assumptions about the values of IDs.
|
1994-05-26 05:23:31 +00:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width Pa -compact
|
1994-09-07 22:54:00 +00:00
|
|
|
.It Pa /etc/pwd.db
|
1994-05-26 05:23:31 +00:00
|
|
|
The insecure password database file.
|
1994-09-07 22:54:00 +00:00
|
|
|
.It Pa /etc/pwd.db.tmp
|
1994-05-26 05:23:31 +00:00
|
|
|
A temporary file.
|
1994-09-07 22:54:00 +00:00
|
|
|
.It Pa /etc/spwd.db
|
1994-05-26 05:23:31 +00:00
|
|
|
The secure password database file.
|
1994-09-07 22:54:00 +00:00
|
|
|
.It Pa /etc/spwd.db.tmp
|
1994-05-26 05:23:31 +00:00
|
|
|
A temporary file.
|
|
|
|
.It Pa /etc/master.passwd
|
|
|
|
The current password file.
|
|
|
|
.It Pa /etc/passwd
|
|
|
|
A Version 7 format password file.
|
|
|
|
.El
|
2014-02-05 09:28:02 +00:00
|
|
|
.Sh EXAMPLES
|
|
|
|
Regenerate the password database after manually editing or replacing
|
|
|
|
the password file:
|
|
|
|
.Bd -literal -offset -indent
|
2014-02-06 09:57:27 +00:00
|
|
|
/usr/sbin/pwd_mkdb -p /etc/master.passwd
|
2014-02-05 09:28:02 +00:00
|
|
|
.Ed
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh COMPATIBILITY
|
|
|
|
Previous versions of the system had a program similar to
|
|
|
|
.Nm ,
|
|
|
|
.Xr mkpasswd 8 ,
|
|
|
|
which built
|
|
|
|
.Xr dbm 3
|
|
|
|
style databases for the password file but depended on the calling programs
|
|
|
|
to install them.
|
|
|
|
The program was renamed in order that previous users of the program
|
|
|
|
not be surprised by the changes in functionality.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr chpass 1 ,
|
|
|
|
.Xr passwd 1 ,
|
|
|
|
.Xr db 3 ,
|
|
|
|
.Xr getpwent 3 ,
|
|
|
|
.Xr passwd 5 ,
|
|
|
|
.Xr vipw 8
|
1994-05-26 05:23:31 +00:00
|
|
|
.Sh BUGS
|
|
|
|
Because of the necessity for atomic update of the password files,
|
1997-10-10 06:27:07 +00:00
|
|
|
.Nm
|
1994-05-26 05:23:31 +00:00
|
|
|
uses
|
|
|
|
.Xr rename 2
|
|
|
|
to install them.
|
|
|
|
This, however, requires that the file specified on the command line live
|
2002-12-12 17:26:04 +00:00
|
|
|
on the same file system as the
|
1997-10-10 06:27:07 +00:00
|
|
|
.Pa /etc
|
1994-05-26 05:23:31 +00:00
|
|
|
directory.
|
|
|
|
.Pp
|
|
|
|
There are the obvious races with multiple people running
|
1997-10-10 06:27:07 +00:00
|
|
|
.Nm
|
1994-05-26 05:23:31 +00:00
|
|
|
on different password files at the same time.
|
2001-07-15 08:06:20 +00:00
|
|
|
The front-ends to
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm ,
|
1994-05-26 05:23:31 +00:00
|
|
|
.Xr chpass 1 ,
|
|
|
|
.Xr passwd 1
|
|
|
|
and
|
|
|
|
.Xr vipw 8 ,
|
|
|
|
handle the locking necessary to avoid this problem.
|