]>
Commit | Line | Data |
---|---|---|
c3a08f59 A |
1 | .\" $OpenBSD: pwd_mkdb.8,v 1.17 2003/06/12 12:59:52 jmc Exp $ |
2 | .\" | |
1815bff5 A |
3 | .\" Copyright (c) 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | |
5 | .\" | |
6 | .\" Redistribution and use in source and binary forms, with or without | |
7 | .\" modification, are permitted provided that the following conditions | |
8 | .\" are met: | |
9 | .\" 1. Redistributions of source code must retain the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer. | |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
12 | .\" notice, this list of conditions and the following disclaimer in the | |
13 | .\" documentation and/or other materials provided with the distribution. | |
c3a08f59 | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
1815bff5 A |
15 | .\" may be used to endorse or promote products derived from this software |
16 | .\" without specific prior written permission. | |
17 | .\" | |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
28 | .\" SUCH DAMAGE. | |
29 | .\" | |
c3a08f59 | 30 | .\" from: @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93 |
1815bff5 | 31 | .\" |
c3a08f59 | 32 | .Dd June 6, 1993 |
1815bff5 A |
33 | .Dt PWD_MKDB 8 |
34 | .Os | |
35 | .Sh NAME | |
36 | .Nm pwd_mkdb | |
c3a08f59 | 37 | .Nd generate the password databases |
1815bff5 A |
38 | .Sh SYNOPSIS |
39 | .Nm pwd_mkdb | |
c3a08f59 A |
40 | .Op Fl c |
41 | .Op Fl p | Fl s | |
42 | .Op Fl d Ar directory | |
43 | .Op Fl u Ar username | |
1815bff5 A |
44 | .Ar file |
45 | .Sh DESCRIPTION | |
34d340d7 | 46 | .Nm pwd_mkdb |
1815bff5 A |
47 | creates |
48 | .Xr db 3 | |
49 | style secure and insecure databases for the specified file. | |
50 | These databases are then installed into | |
c3a08f59 | 51 | .Pa /etc/spwd.db |
1815bff5 | 52 | and |
c3a08f59 | 53 | .Pa /etc/pwd.db , |
1815bff5 A |
54 | respectively. |
55 | The file is installed into | |
c3a08f59 | 56 | .Pa /etc/master.passwd . |
1815bff5 A |
57 | The file must be in the correct format (see |
58 | .Xr passwd 5 ) . | |
59 | It is important to note that the format used in this system is | |
60 | different from the historic Version 7 style format. | |
61 | .Pp | |
62 | The options are as follows: | |
c3a08f59 | 63 | .Bl -tag -width Ds |
34d340d7 | 64 | .\" ========== |
c3a08f59 A |
65 | .It Fl c |
66 | Check if the password file is in the correct format. | |
67 | Do not change, add, or remove any files. | |
34d340d7 | 68 | .\" ========== |
c3a08f59 A |
69 | .It Fl d Ar directory |
70 | Operate in a base directory other than the default of | |
71 | .Pa /etc . | |
72 | All absolute paths (including | |
73 | .Ar file ) | |
74 | will be made relative to | |
75 | .Ar directory . | |
76 | Any directories specified as a part of | |
77 | .Ar file | |
78 | will be stripped off. | |
79 | This option is used to create password databases in directories | |
80 | other than | |
81 | .Pa etc ; | |
82 | for instance in a | |
83 | .Xr chroot 8 | |
84 | jail. | |
34d340d7 A |
85 | .\" ========== |
86 | .It Fl p | |
87 | Create a Version 7 style password file and install it into | |
88 | .Pa /etc/passwd . | |
89 | .\" ========== | |
90 | .It Fl s | |
91 | Only update the secure version of the database. | |
92 | This is most commonly used in conjunction with the | |
93 | .Fl u | |
94 | flag during a password change. | |
95 | Because the insecure database doesn't contain the password there | |
96 | is no reason to update it if the only change is in the password field. | |
97 | Cannot be used in conjunction with the | |
98 | .Fl p | |
99 | flag. | |
100 | .\" ========== | |
c3a08f59 A |
101 | .It Fl u Ar username |
102 | Only update the record for the specified user. | |
103 | Utilities that operate on a single user can use this option to avoid the | |
104 | overhead of rebuilding the entire database. | |
105 | This option must never be used if the line number of the user's record in | |
106 | .Pa /etc/master.passwd | |
107 | has changed. | |
34d340d7 | 108 | .\" ========== |
c3a08f59 A |
109 | .It Ar file |
110 | The absolute path to a file in | |
111 | .Ar master.passwd | |
112 | format, as described in | |
113 | .Xr passwd 5 . | |
1815bff5 A |
114 | .El |
115 | .Pp | |
c3a08f59 A |
116 | The two databases differ in that the secure version contains the user's |
117 | encrypted password and the insecure version has an asterisk | |
118 | .Pq Sq \&* . | |
1815bff5 A |
119 | .Pp |
120 | The databases are used by the C library password routines (see | |
121 | .Xr getpwent 3 ) . | |
122 | .Pp | |
34d340d7 | 123 | .Nm pwd_mkdb |
1815bff5 A |
124 | exits zero on success, non-zero on failure. |
125 | .Sh FILES | |
c3a08f59 | 126 | .Bl -tag -width /etc/master.passwd -compact |
1815bff5 | 127 | .It Pa /etc/master.passwd |
c3a08f59 | 128 | current password file |
1815bff5 | 129 | .It Pa /etc/passwd |
c3a08f59 | 130 | a Version 7 format password file |
1815bff5 | 131 | .It Pa /etc/pwd.db |
c3a08f59 | 132 | insecure password database file |
1815bff5 | 133 | .It Pa /etc/pwd.db.tmp |
c3a08f59 | 134 | temporary file |
1815bff5 | 135 | .It Pa /etc/spwd.db |
c3a08f59 | 136 | secure password database file |
1815bff5 | 137 | .It Pa /etc/spwd.db.tmp |
c3a08f59 | 138 | temporary file |
1815bff5 | 139 | .El |
c3a08f59 A |
140 | .Sh SEE ALSO |
141 | .Xr chpass 1 , | |
142 | .Xr passwd 1 , | |
143 | .Xr db 3 , | |
144 | .Xr getpwent 3 , | |
145 | .Xr passwd 5 , | |
146 | .Xr vipw 8 | |
147 | .Sh STANDARDS | |
148 | Previous versions of the system had a program similar to | |
149 | .Nm pwd_mkdb , | |
150 | .Xr mkpasswd , | |
151 | which built | |
152 | .Xr dbm 3 | |
153 | style databases for the password file but depended on the calling programs | |
154 | to install them. | |
155 | The program was renamed in order that previous users of the program | |
156 | not be surprised by the changes in functionality. | |
1815bff5 A |
157 | .Sh BUGS |
158 | Because of the necessity for atomic update of the password files, | |
34d340d7 | 159 | .Nm pwd_mkdb |
1815bff5 A |
160 | uses |
161 | .Xr rename 2 | |
162 | to install them. | |
163 | This, however, requires that the file specified on the command line live | |
164 | on the same file system as the | |
c3a08f59 | 165 | .Pa /etc |
1815bff5 A |
166 | directory. |
167 | .Pp | |
168 | There are the obvious races with multiple people running | |
34d340d7 | 169 | .Nm pwd_mkdb |
1815bff5 | 170 | on different password files at the same time. |
c3a08f59 | 171 | The front-ends to |
1815bff5 A |
172 | .Nm pwd_mkdb , |
173 | .Xr chpass 1 , | |
1815bff5 | 174 | .Xr passwd 1 , |
c3a08f59 | 175 | and |
1815bff5 | 176 | .Xr vipw 8 |
c3a08f59 | 177 | handle the locking necessary to avoid this problem. |