Commit | Line | Data |
---|---|---|
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 | |
11 | pwd_mkdb \- generate the password databases | |
12 | .SH SYNOPSIS | |
13 | .nf | |
14 | .ft B | |
15 | pwd_mkdb [ \-p ] file | |
16 | .SH DESCRIPTION | |
17 | .I Pwd_mkdb | |
18 | creates | |
19 | .IR db (3) | |
20 | style secure and insecure databases for the specified file. | |
21 | These databases are then installed into ``/var/db/spwd.db'' and | |
22 | ``/var/db/pwd.db'' respectively. | |
23 | The file is installed into ``/etc/master.passwd''. | |
24 | The file must be in the correct format (see | |
25 | .IR passwd (5)). | |
26 | It is important to note that the format used in this system is | |
27 | different from the historic Version 7 style format. | |
28 | .PP | |
29 | The options are as follows: | |
30 | .TP | |
31 | \-p | |
32 | Create a Version 7 style password file and install it into ``/etc/password''. | |
33 | .PP | |
34 | The databases actually contain three copies of the original data. | |
35 | Each password file entry is converted into a rough approximation of a | |
36 | ``struct passwd'', with the strings placed inline. | |
37 | This object is then stored as the data for three separate keys. | |
38 | The first key is the pw_name field prepended by the _PW_KEYBYNAME character. | |
39 | The second key is the pw_uid field prepended by the _PW_KEYBYUID character. | |
40 | The 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 | |
43 | collide.) | |
44 | .PP | |
45 | The two databases differ in that the secure version contains the user's | |
46 | encrypted password and the insecure version has an asterisk (``*'') | |
47 | .PP | |
48 | The databases are used by the C library password routines (see | |
49 | .IR getpwent (3)). | |
50 | .PP | |
51 | .I Pwd_mkdb | |
52 | exits 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 | |
66 | Because of the necessity for atomic update of the password files, | |
67 | .I pwd_mkdb | |
68 | uses | |
69 | .IR rename (2) | |
70 | to install them. | |
71 | This, however, requires that the file specified on the command line live | |
72 | on the same file system as the ``/etc'' directory. | |
73 | .PP | |
74 | There are the obvious races with multiple people running | |
75 | .I pwd_mkdb | |
76 | on different password files at the same time. | |
77 | The front-ends to | |
78 | .IR pwd_mkdb , | |
79 | .IR chpass (1), | |
80 | .IR passwd (1) | |
81 | and | |
82 | .IR vipw (8), | |
83 | handle the locking necessary to avoid this problem. | |
84 | .SH COMPATIBILITY | |
85 | Previous versions of the system had a program similar to | |
86 | .I pwd_mkdb, | |
87 | .IR mkpasswd (8), | |
88 | which built | |
89 | .I dbm (3) | |
90 | style databases for the password file but depended on the calling programs | |
91 | to install them. | |
92 | The program was renamed in order that previous users of the program | |
93 | not be surprised by the changes in functionality. | |
94 | .SH SEE ALSO | |
95 | chpass(1), passwd(1), db(3), getpwent(3), passwd(5), vipw(8) |