xref: /freebsd/share/man/man5/passwd.5 (revision c00809fcf903b9ca057cd12225f36cb72eddeeff)
1248aee62SJacques Vidrine.\"	$NetBSD: passwd.5,v 1.12.2.2 1999/12/17 23:14:50 he Exp $
2248aee62SJacques Vidrine.\"
3afe61c15SRodney W. Grimes.\" Copyright (c) 1988, 1991, 1993
4afe61c15SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
5248aee62SJacques Vidrine.\" Portions Copyright (c) 1994, Jason Downs.  All rights reserved.
6afe61c15SRodney W. Grimes.\"
7afe61c15SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
8afe61c15SRodney W. Grimes.\" modification, are permitted provided that the following conditions
9afe61c15SRodney W. Grimes.\" are met:
10afe61c15SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
11afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
12afe61c15SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
13afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
14afe61c15SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
15afe61c15SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
16afe61c15SRodney W. Grimes.\"    must display the following acknowledgement:
17afe61c15SRodney W. Grimes.\"	This product includes software developed by the University of
18afe61c15SRodney W. Grimes.\"	California, Berkeley and its contributors.
19afe61c15SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
20afe61c15SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
21afe61c15SRodney W. Grimes.\"    without specific prior written permission.
22afe61c15SRodney W. Grimes.\"
23afe61c15SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24afe61c15SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25afe61c15SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26afe61c15SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27afe61c15SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28afe61c15SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29afe61c15SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30afe61c15SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31afe61c15SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32afe61c15SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33afe61c15SRodney W. Grimes.\" SUCH DAMAGE.
34afe61c15SRodney W. Grimes.\"
35f274239bSGarrett Wollman.\"     From: @(#)passwd.5	8.1 (Berkeley) 6/5/93
367f3dea24SPeter Wemm.\" $FreeBSD$
37afe61c15SRodney W. Grimes.\"
38248aee62SJacques Vidrine.Dd January 16, 1999
39afe61c15SRodney W. Grimes.Dt PASSWD 5
40afe61c15SRodney W. Grimes.Os
41afe61c15SRodney W. Grimes.Sh NAME
42248aee62SJacques Vidrine.Nm passwd ,
43248aee62SJacques Vidrine.Nm master.passwd
44afe61c15SRodney W. Grimes.Nd format of the password file
45afe61c15SRodney W. Grimes.Sh DESCRIPTION
46afe61c15SRodney W. GrimesThe
474b66483fSRuslan Ermilov.Nm
48248aee62SJacques Vidrinefiles are the local source of password information.
49248aee62SJacques VidrineThey can be used in conjunction with the Hesiod domains
50248aee62SJacques Vidrine.Sq passwd
51248aee62SJacques Vidrineand
52248aee62SJacques Vidrine.Sq uid ,
53248aee62SJacques Vidrineand the
54248aee62SJacques Vidrine.Tn NIS
55248aee62SJacques Vidrinemaps
56248aee62SJacques Vidrine.Sq passwd.byname ,
57248aee62SJacques Vidrine.Sq passwd.byuid ,
58248aee62SJacques Vidrine.Sq master.passwd.byname ,
59248aee62SJacques Vidrineand
60248aee62SJacques Vidrine.Sq master.passwd.byuid ,
61248aee62SJacques Vidrineas controlled by
62248aee62SJacques Vidrine.Xr nsswitch.conf 5 .
63248aee62SJacques Vidrine.Pp
64248aee62SJacques VidrineThe
65248aee62SJacques Vidrine.Nm master.passwd
66248aee62SJacques Vidrinefile is readable only by root, and consists of newline separated
67248aee62SJacques Vidrinerecords, one per user, containing ten colon (``:'') separated
68248aee62SJacques Vidrinefields.  These fields are as follows:
69afe61c15SRodney W. Grimes.Pp
70afe61c15SRodney W. Grimes.Bl -tag -width password -offset indent
71afe61c15SRodney W. Grimes.It name
72afe61c15SRodney W. GrimesUser's login name.
73afe61c15SRodney W. Grimes.It password
74afe61c15SRodney W. GrimesUser's
75afe61c15SRodney W. Grimes.Em encrypted
76afe61c15SRodney W. Grimespassword.
77afe61c15SRodney W. Grimes.It uid
78afe61c15SRodney W. GrimesUser's id.
79afe61c15SRodney W. Grimes.It gid
80afe61c15SRodney W. GrimesUser's login group id.
81afe61c15SRodney W. Grimes.It class
82248aee62SJacques VidrineUser's general classification (unused).
83afe61c15SRodney W. Grimes.It change
84afe61c15SRodney W. GrimesPassword change time.
85afe61c15SRodney W. Grimes.It expire
86afe61c15SRodney W. GrimesAccount expiration time.
87afe61c15SRodney W. Grimes.It gecos
88afe61c15SRodney W. GrimesGeneral information about the user.
89afe61c15SRodney W. Grimes.It home_dir
90afe61c15SRodney W. GrimesUser's home directory.
91afe61c15SRodney W. Grimes.It shell
92afe61c15SRodney W. GrimesUser's login shell.
93afe61c15SRodney W. Grimes.El
94afe61c15SRodney W. Grimes.Pp
95248aee62SJacques VidrineThe
96248aee62SJacques Vidrine.Nm
97248aee62SJacques Vidrinefile is generated from the
98d722865aSDima Dorfman.Nm master.passwd
99248aee62SJacques Vidrinefile by
100248aee62SJacques Vidrine.Xr pwd_mkdb 8 ,
101248aee62SJacques Vidrinehas the class, change, and expire fields removed, and the password
102248aee62SJacques Vidrinefield replaced by a ``*''.
10322bf9812SWolfram Schneider.Pp
104afe61c15SRodney W. GrimesThe
105afe61c15SRodney W. Grimes.Ar name
106afe61c15SRodney W. Grimesfield is the login used to access the computer account, and the
107afe61c15SRodney W. Grimes.Ar uid
108afe61c15SRodney W. Grimesfield is the number associated with it.  They should both be unique
109afe61c15SRodney W. Grimesacross the system (and often across a group of systems) since they
110afe61c15SRodney W. Grimescontrol file access.
111afe61c15SRodney W. Grimes.Pp
112afe61c15SRodney W. GrimesWhile it is possible to have multiple entries with identical login names
113248aee62SJacques Vidrineand/or identical user id's, it is usually a mistake to do so.  Routines
114afe61c15SRodney W. Grimesthat manipulate these files will often return only one of the multiple
115afe61c15SRodney W. Grimesentries, and that one by random selection.
116afe61c15SRodney W. Grimes.Pp
117248aee62SJacques VidrineThe login name must never begin with a hyphen (``-''); also, it is strongly
118248aee62SJacques Vidrinesuggested that neither upper-case characters or dots (``.'') be part
119248aee62SJacques Vidrineof the name, as this tends to confuse mailers.  No field may contain a
120248aee62SJacques Vidrinecolon (``:'') as this has been used historically to separate the fields
121248aee62SJacques Vidrinein the user database.
122afe61c15SRodney W. Grimes.Pp
123afe61c15SRodney W. GrimesThe password field is the
124afe61c15SRodney W. Grimes.Em encrypted
125afe61c15SRodney W. Grimesform of the password.
126afe61c15SRodney W. GrimesIf the
127afe61c15SRodney W. Grimes.Ar password
128afe61c15SRodney W. Grimesfield is empty, no password will be required to gain access to the
129afe61c15SRodney W. Grimesmachine.  This is almost invariably a mistake.
130afe61c15SRodney W. GrimesBecause these files contain the encrypted user passwords, they should
131afe61c15SRodney W. Grimesnot be readable by anyone without appropriate privileges.
132afe61c15SRodney W. Grimes.Pp
133afe61c15SRodney W. GrimesThe group field is the group that the user will be placed in upon login.
134248aee62SJacques VidrineSince this system supports multiple groups (see
135afe61c15SRodney W. Grimes.Xr groups 1 )
136248aee62SJacques Vidrinethis field currently has little special meaning.
137afe61c15SRodney W. Grimes.Pp
138afe61c15SRodney W. GrimesThe
139afe61c15SRodney W. Grimes.Ar class
140248aee62SJacques Vidrinefield is a key for a user's login class. Login classes
141248aee62SJacques Vidrineare defined in
142408bc30dSDavid Nugent.Xr login.conf 5 ,
143408bc30dSDavid Nugentwhich is a
144afe61c15SRodney W. Grimes.Xr termcap 5
145248aee62SJacques Vidrinestyle database of user attributes, accounting, resource,
146248aee62SJacques Vidrineand environment settings.
147afe61c15SRodney W. Grimes.Pp
148afe61c15SRodney W. GrimesThe
149afe61c15SRodney W. Grimes.Ar change
150248aee62SJacques Vidrinefield is the number of seconds from the epoch,
151248aee62SJacques Vidrine.Dv UTC ,
152248aee62SJacques Vidrineuntil the
153afe61c15SRodney W. Grimespassword for the account must be changed.
154248aee62SJacques VidrineThis field may be left empty to turn off the password aging feature.
155afe61c15SRodney W. Grimes.Pp
156afe61c15SRodney W. GrimesThe
157afe61c15SRodney W. Grimes.Ar expire
158248aee62SJacques Vidrinefield is the number of seconds from the epoch,
159248aee62SJacques Vidrine.Dv UTC ,
160248aee62SJacques Vidrineuntil the
161afe61c15SRodney W. Grimesaccount expires.
162248aee62SJacques VidrineThis field may be left empty to turn off the account aging feature.
163afe61c15SRodney W. Grimes.Pp
164afe61c15SRodney W. GrimesThe
165afe61c15SRodney W. Grimes.Ar gecos
166248aee62SJacques Vidrinefield normally contains comma (``,'') separated subfields as follows:
167afe61c15SRodney W. Grimes.Pp
168248aee62SJacques Vidrine.Bl -tag -width office -offset indent -compact
169248aee62SJacques Vidrine.It name
1709ec4c09aSGarrett Wollmanuser's full name
171248aee62SJacques Vidrine.It office
172248aee62SJacques Vidrineuser's office number
173248aee62SJacques Vidrine.It wphone
1749ec4c09aSGarrett Wollmanuser's work phone number
175248aee62SJacques Vidrine.It hphone
1769ec4c09aSGarrett Wollmanuser's home phone number
1779ec4c09aSGarrett Wollman.El
178afe61c15SRodney W. Grimes.Pp
179248aee62SJacques VidrineThe full name may contain a ampersand (``&'') which will be replaced by
180248aee62SJacques Vidrinethe capitalized login name when the gecos field is displayed or used
181248aee62SJacques Vidrineby various programs such as
182248aee62SJacques Vidrine.Xr finger 1 ,
183248aee62SJacques Vidrine.Xr sendmail 8 ,
184248aee62SJacques Vidrineetc.
185248aee62SJacques Vidrine.Pp
186248aee62SJacques VidrineThe office and phone number subfields are used by the
187afe61c15SRodney W. Grimes.Xr finger 1
188248aee62SJacques Vidrineprogram, and possibly other applications.
189afe61c15SRodney W. Grimes.Pp
190afe61c15SRodney W. GrimesThe user's home directory is the full
191248aee62SJacques Vidrine.Ux
192afe61c15SRodney W. Grimespath name where the user
193afe61c15SRodney W. Grimeswill be placed on login.
194afe61c15SRodney W. Grimes.Pp
195afe61c15SRodney W. GrimesThe shell field is the command interpreter the user prefers.
196afe61c15SRodney W. GrimesIf there is nothing in the
197afe61c15SRodney W. Grimes.Ar shell
198afe61c15SRodney W. Grimesfield, the Bourne shell
199afe61c15SRodney W. Grimes.Pq Pa /bin/sh
200afe61c15SRodney W. Grimesis assumed.
201248aee62SJacques Vidrine.Sh HESIOD SUPPORT
202248aee62SJacques VidrineIf
203248aee62SJacques Vidrine.Sq dns
204248aee62SJacques Vidrineis specified for the
205248aee62SJacques Vidrine.Sq passwd
206248aee62SJacques Vidrinedatabase in
207248aee62SJacques Vidrine.Xr nsswitch.conf 5 ,
208248aee62SJacques Vidrinethen
209248aee62SJacques Vidrine.Nm
210248aee62SJacques Vidrinelookups occur from the
211248aee62SJacques Vidrine.Sq passwd
212248aee62SJacques VidrineHesiod domain.
213248aee62SJacques Vidrine.Sh NIS SUPPORT
214248aee62SJacques VidrineIf
215248aee62SJacques Vidrine.Sq nis
216248aee62SJacques Vidrineis specified for the
217248aee62SJacques Vidrine.Sq passwd
218248aee62SJacques Vidrinedatabase in
219248aee62SJacques Vidrine.Xr nsswitch.conf 5 ,
220248aee62SJacques Vidrinethen
221248aee62SJacques Vidrine.Nm
222248aee62SJacques Vidrinelookups occur from the
223248aee62SJacques Vidrine.Sq passwd.byname ,
224248aee62SJacques Vidrine.Sq passwd.byuid ,
225248aee62SJacques Vidrine.Sq master.passwd.byname ,
2269ec4c09aSGarrett Wollmanand
227248aee62SJacques Vidrine.Sq master.passwd.byuid
228248aee62SJacques Vidrine.Tn NIS
229dd5527c6SMike Pritchardmaps.
230248aee62SJacques Vidrine.Sh COMPAT SUPPORT
231248aee62SJacques VidrineIf
232248aee62SJacques Vidrine.Sq compat
233248aee62SJacques Vidrineis specified for the
234248aee62SJacques Vidrine.Sq passwd
235248aee62SJacques Vidrinedatabase, and either
236248aee62SJacques Vidrine.Sq dns
237248aee62SJacques Vidrineor
238248aee62SJacques Vidrine.Sq nis
239248aee62SJacques Vidrineis specified for the
240248aee62SJacques Vidrine.Sq passwd_compat
241248aee62SJacques Vidrinedatabase in
242248aee62SJacques Vidrine.Xr nsswitch.conf 5 ,
243248aee62SJacques Vidrinethen the
244248aee62SJacques Vidrine.Nm
245248aee62SJacques Vidrinefile also supports standard
246248aee62SJacques Vidrine.Sq +/-
247248aee62SJacques Vidrineexclusions and inclusions, based on user names and netgroups.
248a755ea5bSBill Paul.Pp
249248aee62SJacques VidrineLines beginning with a ``-'' (minus sign) are entries marked as being excluded
250248aee62SJacques Vidrinefrom any following inclusions, which are marked with a ``+'' (plus sign).
251a755ea5bSBill Paul.Pp
252248aee62SJacques VidrineIf the second character of the line is a ``@'' (at sign), the operation
253248aee62SJacques Vidrineinvolves the user fields of all entries in the netgroup specified by the
254248aee62SJacques Vidrineremaining characters of the
255248aee62SJacques Vidrine.Ar name
256248aee62SJacques Vidrinefield.
257248aee62SJacques VidrineOtherwise, the remainder of the
258248aee62SJacques Vidrine.Ar name
259248aee62SJacques Vidrinefield is assumed to be a specific user name.
260a755ea5bSBill Paul.Pp
261248aee62SJacques VidrineThe ``+'' token may also be alone in the
262248aee62SJacques Vidrine.Ar name
263248aee62SJacques Vidrinefield, which causes all users from either the Hesiod domain
264248aee62SJacques Vidrine.Nm
265248aee62SJacques Vidrine(with
266248aee62SJacques Vidrine.Sq passwd_compat: dns )
267248aee62SJacques Vidrineor
268248aee62SJacques Vidrine.Sq passwd.byname
269a755ea5bSBill Pauland
270248aee62SJacques Vidrine.Sq passwd.byuid
271248aee62SJacques Vidrine.Tn NIS
272248aee62SJacques Vidrinemaps (with
273248aee62SJacques Vidrine.Sq passwd_compat: nis )
274248aee62SJacques Vidrineto be included.
275a755ea5bSBill Paul.Pp
276248aee62SJacques VidrineIf the entry contains non-empty
277248aee62SJacques Vidrine.Ar uid
278248aee62SJacques Vidrineor
279248aee62SJacques Vidrine.Ar gid
280248aee62SJacques Vidrinefields, the specified numbers will override the information retrieved
281248aee62SJacques Vidrinefrom the Hesiod domain or the
282248aee62SJacques Vidrine.Tn NIS
283248aee62SJacques Vidrinemaps. As well, if the
284248aee62SJacques Vidrine.Ar gecos ,
285248aee62SJacques Vidrine.Ar dir
286248aee62SJacques Vidrineor
287248aee62SJacques Vidrine.Ar shell
288248aee62SJacques Vidrineentries contain text, it will override the information included via
289248aee62SJacques VidrineHesiod or
290248aee62SJacques Vidrine.Tn NIS .
291248aee62SJacques VidrineOn some systems, the
292248aee62SJacques Vidrine.Ar passwd
293248aee62SJacques Vidrinefield may also be overridden.
294489587c5SDima Dorfman.Sh FILES
295489587c5SDima Dorfman.Bl -tag -width /etc/master.passwd -compact
296489587c5SDima Dorfman.It Pa /etc/passwd
297489587c5SDima Dorfman.Tn ASCII
298489587c5SDima Dorfmanpassword file, with passwords removed
299489587c5SDima Dorfman.It Pa /etc/pwd.db
300c00809fcSDima Dorfman.Xr db 3 Ns -format
301489587c5SDima Dorfmanpassword database, with passwords removed
302489587c5SDima Dorfman.It Pa /etc/master.passwd
303489587c5SDima Dorfman.Tn ASCII
304489587c5SDima Dorfmanpassword file, with passwords intact
305489587c5SDima Dorfman.It Pa /etc/spwd.db
306c00809fcSDima Dorfman.Xr db 3 Ns -format
307489587c5SDima Dorfmanpassword database, with passwords intact
308489587c5SDima Dorfman.El
309afe61c15SRodney W. Grimes.Sh SEE ALSO
310afe61c15SRodney W. Grimes.Xr chpass 1 ,
311afe61c15SRodney W. Grimes.Xr login 1 ,
312afe61c15SRodney W. Grimes.Xr passwd 1 ,
313c69a537cSWolfram Schneider.Xr getpwent 3 ,
314248aee62SJacques Vidrine.Xr netgroup 5 ,
315c69a537cSWolfram Schneider.Xr adduser 8 ,
316def37e7cSMike Pritchard.Xr pwd_mkdb 8 ,
317491a8429SRuslan Ermilov.Xr vipw 8 ,
318491a8429SRuslan Ermilov.Xr yp 8
319248aee62SJacques Vidrine.Pp
320248aee62SJacques Vidrine.%T "Managing NFS and NIS"
321248aee62SJacques Vidrine(O'Reilly & Associates)
322afe61c15SRodney W. Grimes.Sh BUGS
323afe61c15SRodney W. GrimesUser information should (and eventually will) be stored elsewhere.
324f274239bSGarrett Wollman.Pp
325248aee62SJacques VidrinePlacing
326248aee62SJacques VidrineSq compat
327248aee62SJacques Vidrineexclusions in the file after any inclusions will have
328248aee62SJacques Vidrineunexpected results.
329afe61c15SRodney W. Grimes.Sh COMPATIBILITY
33021421932SMike PritchardThe password file format has changed since
33121421932SMike Pritchard.Bx 4.3 .
332afe61c15SRodney W. GrimesThe following awk script can be used to convert your old-style password
333afe61c15SRodney W. Grimesfile into a new style password file.
334afe61c15SRodney W. GrimesThe additional fields
335afe61c15SRodney W. Grimes.Dq class ,
336afe61c15SRodney W. Grimes.Dq change
337afe61c15SRodney W. Grimesand
338afe61c15SRodney W. Grimes.Dq expire
339afe61c15SRodney W. Grimesare added, but are turned off by default.
340248aee62SJacques VidrineClass is currently not implemented, but change and expire are; to set them,
341248aee62SJacques Vidrineuse the current day in seconds from the epoch + whatever number of seconds
342248aee62SJacques Vidrineof offset you want.
343afe61c15SRodney W. Grimes.Bd -literal -offset indent
344afe61c15SRodney W. GrimesBEGIN { FS = ":"}
345afe61c15SRodney W. Grimes{ print $1 ":" $2 ":" $3 ":" $4 "::0:0:" $5 ":" $6 ":" $7 }
346afe61c15SRodney W. Grimes.Ed
347afe61c15SRodney W. Grimes.Sh HISTORY
348afe61c15SRodney W. GrimesA
349afe61c15SRodney W. Grimes.Nm
350afe61c15SRodney W. Grimesfile format appeared in
351afe61c15SRodney W. Grimes.At v6 .
352248aee62SJacques Vidrine.Pp
353248aee62SJacques VidrineThe
354248aee62SJacques Vidrine.Tn NIS
355248aee62SJacques Vidrine.Nm
356248aee62SJacques Vidrinefile format first appeared in SunOS.
357248aee62SJacques Vidrine.Pp
358248aee62SJacques VidrineThe Hesiod support first appeared in
359248aee62SJacques Vidrine.Fx 4.1 .
360248aee62SJacques VidrineIt was imported from the
361248aee62SJacques Vidrine.Nx
362248aee62SJacques VidrineProject, where it first appeared in
363248aee62SJacques Vidrine.Nx 1.4 .
364