1*167ab6fbSsevan.\" $NetBSD: passwd.5,v 1.34 2019/09/01 18:57:05 sevan Exp $ 2b5930afcSjtc.\" 3b5930afcSjtc.\" Copyright (c) 1988, 1991, 1993 4b5930afcSjtc.\" The Regents of the University of California. All rights reserved. 5075022b3Sagc.\" 6075022b3Sagc.\" Redistribution and use in source and binary forms, with or without 7075022b3Sagc.\" modification, are permitted provided that the following conditions 8075022b3Sagc.\" are met: 9075022b3Sagc.\" 1. Redistributions of source code must retain the above copyright 10075022b3Sagc.\" notice, this list of conditions and the following disclaimer. 11075022b3Sagc.\" 2. Redistributions in binary form must reproduce the above copyright 12075022b3Sagc.\" notice, this list of conditions and the following disclaimer in the 13075022b3Sagc.\" documentation and/or other materials provided with the distribution. 14075022b3Sagc.\" 3. Neither the name of the University nor the names of its contributors 15075022b3Sagc.\" may be used to endorse or promote products derived from this software 16075022b3Sagc.\" without specific prior written permission. 17075022b3Sagc.\" 18075022b3Sagc.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19075022b3Sagc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20075022b3Sagc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21075022b3Sagc.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22075022b3Sagc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23075022b3Sagc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24075022b3Sagc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25075022b3Sagc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26075022b3Sagc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27075022b3Sagc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28075022b3Sagc.\" SUCH DAMAGE. 29075022b3Sagc.\" 30c9d0b91dSphil.\" Portions Copyright (c) 1994, Jason Downs. All rights reserved. 3161f28255Scgd.\" 3261f28255Scgd.\" Redistribution and use in source and binary forms, with or without 3361f28255Scgd.\" modification, are permitted provided that the following conditions 3461f28255Scgd.\" are met: 3561f28255Scgd.\" 1. Redistributions of source code must retain the above copyright 3661f28255Scgd.\" notice, this list of conditions and the following disclaimer. 3761f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright 3861f28255Scgd.\" notice, this list of conditions and the following disclaimer in the 3961f28255Scgd.\" documentation and/or other materials provided with the distribution. 4061f28255Scgd.\" 419f1aac5bSagc.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS 429f1aac5bSagc.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 439f1aac5bSagc.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 449f1aac5bSagc.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, 459f1aac5bSagc.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 469f1aac5bSagc.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 479f1aac5bSagc.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 489f1aac5bSagc.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4961f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5061f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5161f28255Scgd.\" SUCH DAMAGE. 5261f28255Scgd.\" 53b5930afcSjtc.\" @(#)passwd.5 8.1 (Berkeley) 6/5/93 5461f28255Scgd.\" 55*167ab6fbSsevan.Dd September 1, 2019 5661f28255Scgd.Dt PASSWD 5 5761f28255Scgd.Os 5861f28255Scgd.Sh NAME 596be07a67Smrg.Nm passwd , 606be07a67Smrg.Nm master.passwd 6161f28255Scgd.Nd format of the password file 6261f28255Scgd.Sh DESCRIPTION 6361f28255ScgdThe 6461f28255Scgd.Nm passwd 65abda4debSlukemfiles are the local source of password information. 66abda4debSlukemThey can be used in conjunction with the Hesiod domain 67abda4debSlukem.Sq passwd 68abda4debSlukemand the 69abda4debSlukem.Tn NIS 70abda4debSlukemmaps 71abda4debSlukem.Sq passwd.byname , 72abda4debSlukem.Sq passwd.byuid , 73abda4debSlukem.Sq master.passwd.byname , 74abda4debSlukemand 75abda4debSlukem.Sq master.passwd.byuid , 76abda4debSlukemas controlled by 77abda4debSlukem.Xr nsswitch.conf 5 . 78abda4debSlukem.Pp 79abda4debSlukemThe 80060eb8b2Sabs.Nm master.passwd 81060eb8b2Sabsfile is readable only by root, and consists of newline separated 8218a3e2e2Slukem.Tn ASCII 8318a3e2e2Slukemrecords, one per user, containing ten colon 8418a3e2e2Slukem.Pq Dq \&: 8518a3e2e2Slukemseparated fields. 8661f28255Scgd.Pp 8718a3e2e2SlukemEach line has the form: 8818a3e2e2Slukem.Dl name:password:uid:gid:class:change:expire:gecos:home_dir:shell 8918a3e2e2Slukem.Pp 9018a3e2e2SlukemThese fields are as follows: 9118a3e2e2Slukem.Bl -tag -width password -offset indent -compact 9218a3e2e2Slukem.It Em name 9361f28255ScgdUser's login name. 9418a3e2e2Slukem.It Em password 9561f28255ScgdUser's 9661f28255Scgd.Em encrypted 9761f28255Scgdpassword. 9818a3e2e2Slukem.It Em uid 9961f28255ScgdUser's id. 10018a3e2e2Slukem.It Em gid 10161f28255ScgdUser's login group id. 10218a3e2e2Slukem.It Em class 1036009387dSmjlUser's login class. 10418a3e2e2Slukem.It Em change 10561f28255ScgdPassword change time. 10618a3e2e2Slukem.It Em expire 10761f28255ScgdAccount expiration time. 10818a3e2e2Slukem.It Em gecos 10961f28255ScgdGeneral information about the user. 11018a3e2e2Slukem.It Em home_dir 11161f28255ScgdUser's home directory. 11218a3e2e2Slukem.It Em shell 11361f28255ScgdUser's login shell. 11461f28255Scgd.El 11561f28255Scgd.Pp 116175531f6SjmmvBe aware that each line is limited to 1024 characters; longer ones will be 117175531f6Sjmmvignored. 118175531f6SjmmvThis limit can be queried through 119175531f6Sjmmv.Xr sysconf 3 120175531f6Sjmmvby using the 121175531f6Sjmmv.Li _SC_GETPW_R_SIZE_MAX 122175531f6Sjmmvparameter. 123175531f6Sjmmv.Pp 12461f28255ScgdThe 125060eb8b2Sabs.Nm 126060eb8b2Sabsfile is generated from the 1274575d69bSpooka.Nm master.passwd 128060eb8b2Sabsfile by 129060eb8b2Sabs.Xr pwd_mkdb 8 , 13018a3e2e2Slukemhas the 13118a3e2e2Slukem.Em class , 13218a3e2e2Slukem.Em change , 13318a3e2e2Slukemand 13418a3e2e2Slukem.Em expire 13518a3e2e2Slukemfields removed, and the 13618a3e2e2Slukem.Em password 13718a3e2e2Slukemfield replaced by a 13818a3e2e2Slukem.Dq \&* . 139060eb8b2Sabs.Pp 140060eb8b2SabsThe 14118a3e2e2Slukem.Em name 14261f28255Scgdfield is the login used to access the computer account, and the 14318a3e2e2Slukem.Em uid 144115f03ceSwizfield is the number associated with it. 145115f03ceSwizThey should both be unique across the system (and often across a 146115f03ceSwizgroup of systems) since they control file access. 14761f28255Scgd.Pp 14861f28255ScgdWhile it is possible to have multiple entries with identical login names 149115f03ceSwizand/or identical user id's, it is usually a mistake to do so. 150115f03ceSwizRoutines that manipulate these files will often return only one of 151115f03ceSwizthe multiple entries, and that one by random selection. 15261f28255Scgd.Pp 15318a3e2e2SlukemThe login name must never begin with a hyphen 15418a3e2e2Slukem.Pq Dq \&- ; 155d2482f58Swizalso, it is strongly suggested that neither upper-case characters nor dots 15618a3e2e2Slukem.Pq Dq \&. 15718a3e2e2Slukembe part of the name, as this tends to confuse mailers. 15818a3e2e2SlukemNo field may contain a colon 15918a3e2e2Slukem.Pq Dq \&: 16018a3e2e2Slukemas this has been used historically to separate the fields in the user database. 16161f28255Scgd.Pp 16218a3e2e2SlukemThe 16318a3e2e2Slukem.Em password 16418a3e2e2Slukemfield is the 16561f28255Scgd.Em encrypted 16661f28255Scgdform of the password. 16761f28255ScgdIf the 16818a3e2e2Slukem.Em password 16961f28255Scgdfield is empty, no password will be required to gain access to the 170115f03ceSwizmachine. 171115f03ceSwizThis is almost invariably a mistake. 17261f28255ScgdBecause these files contain the encrypted user passwords, they should 17361f28255Scgdnot be readable by anyone without appropriate privileges. 174d2482f58SwizFor the possible ciphers used in this field see 175d2482f58Swiz.Xr passwd.conf 5 . 17661f28255Scgd.Pp 17718a3e2e2SlukemThe 17818a3e2e2Slukem.Em gid 17918a3e2e2Slukemfield is the group that the user will be placed in upon login. 18061f28255ScgdSince this system supports multiple groups (see 18161f28255Scgd.Xr groups 1 ) 18261f28255Scgdthis field currently has little special meaning. 18361f28255Scgd.Pp 18461f28255ScgdThe 18518a3e2e2Slukem.Em class 1866009387dSmjlfield is a key for a user's login class. 1876009387dSmjlLogin classes are defined in 1886009387dSmjl.Xr login.conf 5 , 1896009387dSmjlwhich is a 190258cf0abSroy.Xr capfile 5 1916009387dSmjlstyle database of user attributes, accounting, resource and 1926009387dSmjlenvironment settings. 19361f28255Scgd.Pp 19461f28255ScgdThe 19518a3e2e2Slukem.Em change 1962ba84184Skleinkfield is the number of seconds from the epoch, 1972ba84184Skleink.Dv UTC , 1982ba84184Skleinkuntil the 19961f28255Scgdpassword for the account must be changed. 20061f28255ScgdThis field may be left empty to turn off the password aging feature. 2013c2037d8SlukemIf this is set to 2023c2037d8Slukem.Dq -1 2033c2037d8Slukemthen the user will be prompted to change their password at the next 2043c2037d8Slukemlogin. 20561f28255Scgd.Pp 20661f28255ScgdThe 20718a3e2e2Slukem.Em expire 2082ba84184Skleinkfield is the number of seconds from the epoch, 2092ba84184Skleink.Dv UTC , 2102ba84184Skleinkuntil the 21161f28255Scgdaccount expires. 21261f28255ScgdThis field may be left empty to turn off the account aging feature. 21361f28255Scgd.Pp 2143c2037d8SlukemIf either of the 21518a3e2e2Slukem.Em change 2163c2037d8Slukemor 21718a3e2e2Slukem.Em expire 2183c2037d8Slukemfields are set, the system will remind the user of the impending 2196009387dSmjlchange or expiry if they login within a configurable period 2206009387dSmjl(defaulting to 14 days) before the event. 2213c2037d8Slukem.Pp 22261f28255ScgdThe 22318a3e2e2Slukem.Em gecos 22418a3e2e2Slukemfield normally contains comma 22518a3e2e2Slukem.Pq Dq \&, 22618a3e2e2Slukemseparated subfields as follows: 22761f28255Scgd.Pp 22880e31290Slukem.Bl -tag -width office -offset indent -compact 22918a3e2e2Slukem.It Em name 23080e31290Slukemuser's full name 23118a3e2e2Slukem.It Em office 23280e31290Slukemuser's office number 23318a3e2e2Slukem.It Em wphone 23480e31290Slukemuser's work phone number 23518a3e2e2Slukem.It Em hphone 23680e31290Slukemuser's home phone number 23780e31290Slukem.El 23861f28255Scgd.Pp 2398a940b23SuebayasiThe full name may contain an ampersand 24001869ca4Swiz.Pq Dq \&& 24118a3e2e2Slukemwhich will be replaced by 24246058496Sisthe capitalized login name when the gecos field is displayed or used 24346058496Sisby various programs such as 24446058496Sis.Xr finger 1 , 24584e9c4d0Snjoly.Xr sendmail 1 , 24646058496Sisetc. 24746058496Sis.Pp 24846058496SisThe office and phone number subfields are used by the 24961f28255Scgd.Xr finger 1 25046058496Sisprogram, and possibly other applications. 25161f28255Scgd.Pp 25261f28255ScgdThe user's home directory is the full 253dc026e05Sfair.Ux 25461f28255Scgdpath name where the user 25561f28255Scgdwill be placed on login. 25661f28255Scgd.Pp 25761f28255ScgdThe shell field is the command interpreter the user prefers. 25861f28255ScgdIf there is nothing in the 25918a3e2e2Slukem.Em shell 26061f28255Scgdfield, the Bourne shell 26161f28255Scgd.Pq Pa /bin/sh 26261f28255Scgdis assumed. 263abda4debSlukem.Sh HESIOD SUPPORT 264abda4debSlukemIf 265abda4debSlukem.Sq dns 266abda4debSlukemis specified for the 267abda4debSlukem.Sq passwd 268abda4debSlukemdatabase in 269abda4debSlukem.Xr nsswitch.conf 5 , 270abda4debSlukemthen 271c9d0b91dSphil.Nm 272abda4debSlukemlookups occur from the 273abda4debSlukem.Sq passwd 274abda4debSlukemHesiod domain. 275abda4debSlukem.Sh NIS SUPPORT 276abda4debSlukemIf 277abda4debSlukem.Sq nis 278abda4debSlukemis specified for the 279abda4debSlukem.Sq passwd 280abda4debSlukemdatabase in 281abda4debSlukem.Xr nsswitch.conf 5 , 282abda4debSlukemthen 283abda4debSlukem.Nm 284abda4debSlukemlookups occur from the 285abda4debSlukem.Sq passwd.byname , 286abda4debSlukem.Sq passwd.byuid , 287abda4debSlukem.Sq master.passwd.byname , 288abda4debSlukemand 289abda4debSlukem.Sq master.passwd.byuid 290abda4debSlukem.Tn NIS 291abda4debSlukemmaps. 292abda4debSlukem.Sh COMPAT SUPPORT 293abda4debSlukemIf 294abda4debSlukem.Sq compat 295abda4debSlukemis specified for the 296abda4debSlukem.Sq passwd 297abda4debSlukemdatabase, and either 298abda4debSlukem.Sq dns 299abda4debSlukemor 300abda4debSlukem.Sq nis 301abda4debSlukemis specified for the 302abda4debSlukem.Sq passwd_compat 303abda4debSlukemdatabase in 304abda4debSlukem.Xr nsswitch.conf 5 , 305abda4debSlukemthen the 306abda4debSlukem.Nm 307abda4debSlukemfile also supports standard 308abda4debSlukem.Sq +/- 309abda4debSlukemexclusions and inclusions, based on user names and netgroups. 310c9d0b91dSphil.Pp 31118a3e2e2SlukemLines beginning with a minus sign 31218a3e2e2Slukem.Pq Dq \&- 31318a3e2e2Slukemare entries marked as being excluded from any following inclusions, 31418a3e2e2Slukemwhich are marked with a plus sign 31518a3e2e2Slukem.Pq Dq \&+ . 316c9d0b91dSphil.Pp 31718a3e2e2SlukemIf the second character of the line is an at sign 31818a3e2e2Slukem.Pq Dq \&@ , 31918a3e2e2Slukemthe operation 320c9d0b91dSphilinvolves the user fields of all entries in the netgroup specified by the 321c9d0b91dSphilremaining characters of the 32218a3e2e2Slukem.Em name 323c9d0b91dSphilfield. 324c9d0b91dSphilOtherwise, the remainder of the 32518a3e2e2Slukem.Em name 326c9d0b91dSphilfield is assumed to be a specific user name. 327c9d0b91dSphil.Pp 32818a3e2e2SlukemThe 32918a3e2e2Slukem.Dq \&+ 33018a3e2e2Slukemtoken may also be alone in the 33118a3e2e2Slukem.Em name 332abda4debSlukemfield, which causes all users from either the Hesiod domain 333abda4debSlukem.Nm 334abda4debSlukem(with 335abda4debSlukem.Sq passwd_compat: dns ) 336abda4debSlukemor 337abda4debSlukem.Sq passwd.byname 338c9d0b91dSphiland 339abda4debSlukem.Sq passwd.byuid 340abda4debSlukem.Tn NIS 341abda4debSlukemmaps (with 342abda4debSlukem.Sq passwd_compat: nis ) 343abda4debSlukemto be included. 344c9d0b91dSphil.Pp 345c9d0b91dSphilIf the entry contains non-empty 34618a3e2e2Slukem.Em uid 347c9d0b91dSphilor 34818a3e2e2Slukem.Em gid 349c9d0b91dSphilfields, the specified numbers will override the information retrieved 350abda4debSlukemfrom the Hesiod domain or the 351abda4debSlukem.Tn NIS 352115f03ceSwizmaps. 353115f03ceSwizAs well, if the 35418a3e2e2Slukem.Em gecos , 35518a3e2e2Slukem.Em home_dir 356c9d0b91dSphilor 35718a3e2e2Slukem.Em shell 358abda4debSlukementries contain text, it will override the information included via 359abda4debSlukemHesiod or 360abda4debSlukem.Tn NIS . 361c9d0b91dSphilOn some systems, the 36218a3e2e2Slukem.Em passwd 36398bc6788Sfairfield may also be overridden. 364b5930afcSjtc.Sh COMPATIBILITY 36534a98169SperryThe password file format has changed since 36634a98169Sperry.Bx 4.3 . 367b5930afcSjtcThe following awk script can be used to convert your old-style password 368b5930afcSjtcfile into a new style password file. 369b5930afcSjtcThe additional fields 370b5930afcSjtc.Dq class , 371b5930afcSjtc.Dq change 372b5930afcSjtcand 373b5930afcSjtc.Dq expire 374b5930afcSjtcare added, but are turned off by default. 3756009387dSmjlTo set them, 376b5930afcSjtcuse the current day in seconds from the epoch + whatever number of seconds 377b5930afcSjtcof offset you want. 378b5930afcSjtc.Bd -literal -offset indent 379b5930afcSjtcBEGIN { FS = ":"} 380b5930afcSjtc{ print $1 ":" $2 ":" $3 ":" $4 "::0:0:" $5 ":" $6 ":" $7 } 381b5930afcSjtc.Ed 382c5308616Swiz.Sh SEE ALSO 383c5308616Swiz.Xr chpass 1 , 384c5308616Swiz.Xr login 1 , 385c5308616Swiz.Xr newgrp 1 , 386c5308616Swiz.Xr passwd 1 , 387c5308616Swiz.Xr pwhash 1 , 388c5308616Swiz.Xr getpwent 3 , 389c5308616Swiz.Xr login_getclass 3 , 390c5308616Swiz.Xr login.conf 5 , 391c5308616Swiz.Xr netgroup 5 , 392c5308616Swiz.Xr passwd.conf 5 , 393c5308616Swiz.Xr pwd_mkdb 8 , 3945b481856Suwe.Xr useradd 8 , 395c5308616Swiz.Xr vipw 8 , 396c5308616Swiz.Xr yp 8 397c5308616Swiz.Pp 398c5308616Swiz.%T "Managing NFS and NIS" 39901869ca4Swiz(O'Reilly & Associates) 40061f28255Scgd.Sh HISTORY 40161f28255ScgdA 40261f28255Scgd.Nm 40361f28255Scgdfile format appeared in 404*167ab6fbSsevan.At v1 . 405c9d0b91dSphil.Pp 406abda4debSlukemThe 407abda4debSlukem.Tn NIS 40898bc6788Sfair.Nm 40998bc6788Sfairfile format first appeared in SunOS. 410abda4debSlukem.Pp 411abda4debSlukemThe Hesiod support first appeared in 412abda4debSlukem.Nx 1.4 . 4136009387dSmjl.Pp 4146009387dSmjlThe 4156009387dSmjl.Xr login.conf 5 4166009387dSmjlcapability first appeared in 4176009387dSmjl.Nx 1.5 . 418b9b556a2Swiz.Sh BUGS 419b9b556a2SwizUser information should (and eventually will) be stored elsewhere. 420b9b556a2Swiz.Pp 421b9b556a2SwizPlacing 422b9b556a2Swiz.Sq compat 423b9b556a2Swizexclusions in the file after any inclusions will have 424b9b556a2Swizunexpected results. 425