xref: /netbsd-src/share/man/man5/passwd.5 (revision 481fca6e59249d8ffcf24fef7cfbe7b131bfb080)
1.\"	$NetBSD: passwd.5,v 1.15 2000/01/14 01:04:24 mjl Exp $
2.\"
3.\" Copyright (c) 1988, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\" Portions Copyright (c) 1994, Jason Downs.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"     @(#)passwd.5	8.1 (Berkeley) 6/5/93
36.\"
37.Dd January 14, 2000
38.Dt PASSWD 5
39.Os
40.Sh NAME
41.Nm passwd ,
42.Nm master.passwd
43.Nd format of the password file
44.Sh DESCRIPTION
45The
46.Nm passwd
47files are the local source of password information.
48They can be used in conjunction with the Hesiod domain
49.Sq passwd
50and the
51.Tn NIS
52maps
53.Sq passwd.byname ,
54.Sq passwd.byuid ,
55.Sq master.passwd.byname ,
56and
57.Sq master.passwd.byuid ,
58as controlled by
59.Xr nsswitch.conf 5 .
60.Pp
61The
62.Nm master.passwd
63file is readable only by root, and consists of newline separated
64records, one per user, containing ten colon (``:'') separated
65fields.  These fields are as follows:
66.Pp
67.Bl -tag -width password -offset indent
68.It name
69User's login name.
70.It password
71User's
72.Em encrypted
73password.
74.It uid
75User's id.
76.It gid
77User's login group id.
78.It class
79User's login class.
80.It change
81Password change time.
82.It expire
83Account expiration time.
84.It gecos
85General information about the user.
86.It home_dir
87User's home directory.
88.It shell
89User's login shell.
90.El
91.Pp
92The
93.Nm
94file is generated from the
95.Nm master.password
96file by
97.Xr pwd_mkdb 8 ,
98has the class, change, and expire fields removed, and the password
99field replaced by a ``*''.
100.Pp
101The
102.Ar name
103field is the login used to access the computer account, and the
104.Ar uid
105field is the number associated with it.  They should both be unique
106across the system (and often across a group of systems) since they
107control file access.
108.Pp
109While it is possible to have multiple entries with identical login names
110and/or identical user id's, it is usually a mistake to do so.  Routines
111that manipulate these files will often return only one of the multiple
112entries, and that one by random selection.
113.Pp
114The login name must never begin with a hyphen (``-''); also, it is strongly
115suggested that neither upper-case characters or dots (``.'') be part
116of the name, as this tends to confuse mailers.  No field may contain a
117colon (``:'') as this has been used historically to separate the fields
118in the user database.
119.Pp
120The password field is the
121.Em encrypted
122form of the password.
123If the
124.Ar password
125field is empty, no password will be required to gain access to the
126machine.  This is almost invariably a mistake.
127Because these files contain the encrypted user passwords, they should
128not be readable by anyone without appropriate privileges.
129.Pp
130The group field is the group that the user will be placed in upon login.
131Since this system supports multiple groups (see
132.Xr groups 1 )
133this field currently has little special meaning.
134.Pp
135The
136.Ar class
137field is a key for a user's login class.
138Login classes are defined in
139.Xr login.conf 5 ,
140which is a
141.Xr termcap 5
142style database of user attributes, accounting, resource and
143environment settings.
144.Pp
145The
146.Ar change
147field is the number of seconds from the epoch,
148.Dv UTC ,
149until the
150password for the account must be changed.
151This field may be left empty to turn off the password aging feature.
152If this is set to
153.Dq -1
154then the user will be prompted to change their password at the next
155login.
156.Pp
157The
158.Ar expire
159field is the number of seconds from the epoch,
160.Dv UTC ,
161until the
162account expires.
163This field may be left empty to turn off the account aging feature.
164.Pp
165If either of the
166.Ar change
167or
168.Ar expire
169fields are set, the system will remind the user of the impending
170change or expiry if they login within a configurable period
171(defaulting to 14 days) before the event.
172.Pp
173The
174.Ar gecos
175field normally contains comma (``,'') separated subfields as follows:
176.Pp
177.Bl -tag -width office -offset indent -compact
178.It name
179user's full name
180.It office
181user's office number
182.It wphone
183user's work phone number
184.It hphone
185user's home phone number
186.El
187.Pp
188The full name may contain a ampersand (``&'') which will be replaced by
189the capitalized login name when the gecos field is displayed or used
190by various programs such as
191.Xr finger 1 ,
192.Xr sendmail 8 ,
193etc.
194.Pp
195The office and phone number subfields are used by the
196.Xr finger 1
197program, and possibly other applications.
198.Pp
199The user's home directory is the full
200.Ux
201path name where the user
202will be placed on login.
203.Pp
204The shell field is the command interpreter the user prefers.
205If there is nothing in the
206.Ar shell
207field, the Bourne shell
208.Pq Pa /bin/sh
209is assumed.
210.Sh HESIOD SUPPORT
211If
212.Sq dns
213is specified for the
214.Sq passwd
215database in
216.Xr nsswitch.conf 5 ,
217then
218.Nm
219lookups occur from the
220.Sq passwd
221Hesiod domain.
222.Sh NIS SUPPORT
223If
224.Sq nis
225is specified for the
226.Sq passwd
227database in
228.Xr nsswitch.conf 5 ,
229then
230.Nm
231lookups occur from the
232.Sq passwd.byname ,
233.Sq passwd.byuid ,
234.Sq master.passwd.byname ,
235and
236.Sq master.passwd.byuid
237.Tn NIS
238maps.
239.Sh COMPAT SUPPORT
240If
241.Sq compat
242is specified for the
243.Sq passwd
244database, and either
245.Sq dns
246or
247.Sq nis
248is specified for the
249.Sq passwd_compat
250database in
251.Xr nsswitch.conf 5 ,
252then the
253.Nm
254file also supports standard
255.Sq +/-
256exclusions and inclusions, based on user names and netgroups.
257.Pp
258Lines beginning with a ``-'' (minus sign) are entries marked as being excluded
259from any following inclusions, which are marked with a ``+'' (plus sign).
260.Pp
261If the second character of the line is a ``@'' (at sign), the operation
262involves the user fields of all entries in the netgroup specified by the
263remaining characters of the
264.Ar name
265field.
266Otherwise, the remainder of the
267.Ar name
268field is assumed to be a specific user name.
269.Pp
270The ``+'' token may also be alone in the
271.Ar name
272field, which causes all users from either the Hesiod domain
273.Nm
274(with
275.Sq passwd_compat: dns )
276or
277.Sq passwd.byname
278and
279.Sq passwd.byuid
280.Tn NIS
281maps (with
282.Sq passwd_compat: nis )
283to be included.
284.Pp
285If the entry contains non-empty
286.Ar uid
287or
288.Ar gid
289fields, the specified numbers will override the information retrieved
290from the Hesiod domain or the
291.Tn NIS
292maps. As well, if the
293.Ar gecos,
294.Ar dir
295or
296.Ar shell
297entries contain text, it will override the information included via
298Hesiod or
299.Tn NIS .
300On some systems, the
301.Ar passwd
302field may also be overridden.
303.Sh SEE ALSO
304.Xr chpass 1 ,
305.Xr login 1 ,
306.Xr passwd 1 ,
307.Xr getpwent 3 ,
308.Xr login_getclass 3 ,
309.Xr login.conf 5 ,
310.Xr netgroup 5 ,
311.Xr adduser 8 ,
312.Xr pwd_mkdb 8 ,
313.Xr vipw 8 ,
314.Xr yp 8
315.Pp
316.%T "Managing NFS and NIS"
317(O'Reilly & Associates)
318.Sh BUGS
319User information should (and eventually will) be stored elsewhere.
320.Pp
321Placing
322.Sq compat
323exclusions in the file after any inclusions will have
324unexpected results.
325.Sh COMPATIBILITY
326The password file format has changed since
327.Bx 4.3 .
328The following awk script can be used to convert your old-style password
329file into a new style password file.
330The additional fields
331.Dq class ,
332.Dq change
333and
334.Dq expire
335are added, but are turned off by default.
336To set them,
337use the current day in seconds from the epoch + whatever number of seconds
338of offset you want.
339.Bd -literal -offset indent
340BEGIN { FS = ":"}
341{ print $1 ":" $2 ":" $3 ":" $4 "::0:0:" $5 ":" $6 ":" $7 }
342.Ed
343.Sh HISTORY
344A
345.Nm
346file format appeared in
347.At v6 .
348.Pp
349The
350.Tn NIS
351.Nm
352file format first appeared in SunOS.
353.Pp
354The Hesiod support first appeared in
355.Nx 1.4 .
356.Pp
357The
358.Xr login.conf 5
359capability first appeared in
360.Nx 1.5 .
361