date and time created 91/03/08 14:07:14 by bostic
[unix-history] / usr / src / usr.sbin / pwd_mkdb / pwd_mkdb.8
CommitLineData
aa18b838
KB
1.\" Copyright (c) 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\" @(#)pwd_mkdb.8 5.1 (Berkeley) %G%
7.\"
8.TH PWD_MKDB 8 "
9.UC 7
10.SH NAME
11pwd_mkdb \- generate the password databases
12.SH SYNOPSIS
13.nf
14.ft B
15pwd_mkdb [ \-p ] file
16.SH DESCRIPTION
17.I Pwd_mkdb
18creates
19.IR db (3)
20style secure and insecure databases for the specified file.
21These databases are then installed into ``/var/db/spwd.db'' and
22``/var/db/pwd.db'' respectively.
23The file is installed into ``/etc/master.passwd''.
24The file must be in the correct format (see
25.IR passwd (5)).
26It is important to note that the format used in this system is
27different from the historic Version 7 style format.
28.PP
29The options are as follows:
30.TP
31\-p
32Create a Version 7 style password file and install it into ``/etc/password''.
33.PP
34The databases actually contain three copies of the original data.
35Each password file entry is converted into a rough approximation of a
36``struct passwd'', with the strings placed inline.
37This object is then stored as the data for three separate keys.
38The first key is the pw_name field prepended by the _PW_KEYBYNAME character.
39The second key is the pw_uid field prepended by the _PW_KEYBYUID character.
40The third key is the line number in the original file prepended by the
41_PW_KEYBYNUM character.
42(The special characters are prepended to ensure that the keys do not
43collide.)
44.PP
45The two databases differ in that the secure version contains the user's
46encrypted password and the insecure version has an asterisk (``*'')
47.PP
48The databases are used by the C library password routines (see
49.IR getpwent (3)).
50.PP
51.I Pwd_mkdb
52exits zero on success, non-zero on failure.
53.SH FILES
54/var/db/pwd.db The insecure password database file
55.br
56/var/db/pwd.db.tmp A temporary file
57.br
58/var/db/spwd.db The secure password database file
59.br
60/var/db/spwd.db.tmp A temporary file
61.br
62/etc/master.passwd The current password file
63.br
64/etc/passwd A Version 7 format password file
65.SH BUGS
66Because of the necessity for atomic update of the password files,
67.I pwd_mkdb
68uses
69.IR rename (2)
70to install them.
71This, however, requires that the file specified on the command line live
72on the same file system as the ``/etc'' directory.
73.PP
74There are the obvious races with multiple people running
75.I pwd_mkdb
76on different password files at the same time.
77The front-ends to
78.IR pwd_mkdb ,
79.IR chpass (1),
80.IR passwd (1)
81and
82.IR vipw (8),
83handle the locking necessary to avoid this problem.
84.SH COMPATIBILITY
85Previous versions of the system had a program similar to
86.I pwd_mkdb,
87.IR mkpasswd (8),
88which built
89.I dbm (3)
90style databases for the password file but depended on the calling programs
91to install them.
92The program was renamed in order that previous users of the program
93not be surprised by the changes in functionality.
94.SH SEE ALSO
95chpass(1), passwd(1), db(3), getpwent(3), passwd(5), vipw(8)