1.\" Copyright (c) 1988, 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)chpass.1 8.2 (Berkeley) 12/30/93 33.\" $FreeBSD$ 34.\" 35.Dd December 30, 1993 36.Dt CHPASS 1 37.Os 38.Sh NAME 39.Nm chpass , 40.Nm chfn , 41.Nm chsh , 42.Nm ypchpass , 43.Nm ypchfn , 44.Nm ypchsh 45.Nd add or change user database information 46.Sh SYNOPSIS 47.Nm 48.Op Fl a Ar list 49.Op Fl p Ar encpass 50.Op Fl e Ar expiretime 51.Op Fl s Ar newshell 52.Op user 53.Pp 54.Nm 55.Op Fl oly 56.Op Fl a Ar list 57.Op Fl p Ar encpass 58.Op Fl e Ar expiretime 59.Op Fl s Ar newshell 60.Op Fl d Ar domain 61.Op Fl h Ar host 62.Op user 63.Sh DESCRIPTION 64The 65.Nm 66program 67allows editing of the user database information associated 68with 69.Ar user 70or, by default, the current user. 71The information is formatted and supplied to an editor for changes. 72.Pp 73Only the information that the user is allowed to change is displayed. 74.Pp 75The options are as follows: 76.Bl -tag -width indent 77.It Fl a 78The super-user is allowed to directly supply a user database 79entry, in the format specified by 80.Xr passwd 5 , 81as an argument. 82This argument must be a colon 83.Pq Dq \: 84separated list of all the 85user database fields, although they may be empty. 86.It Fl p 87The super-user is allowed to directly supply an encrypted password field, 88in the format used by 89.Xr crypt 3 , 90as an argument. 91.It Fl e Ar expiretime 92Change the account expire time. 93This option is used to set the expire time 94from a script as if it was done in the interactive editor. 95.It Fl s Ar newshell 96Attempt to change the user's shell to 97.Ar newshell . 98.El 99.Pp 100Possible display items are as follows: 101.Pp 102.Bl -tag -width "Other Information:" -compact -offset indent 103.It Login: 104user's login name 105.It Password: 106user's encrypted password 107.It Uid: 108user's login 109.It Gid: 110user's login group 111.It Class: 112user's general classification 113.It Change: 114password change time 115.It Expire: 116account expiration time 117.It Full Name: 118user's real name 119.It Office Location: 120user's office location (1) 121.It Office Phone: 122user's office phone (1) 123.It Home Phone: 124user's home phone (1) 125.It Other Information: 126any locally defined parameters for user (1) 127.It Home Directory: 128user's home directory 129.It Shell: 130user's login shell 131.Pp 132.It NOTE(1) - 133In the actual master.passwd file, these fields are comma-delimited 134fields embedded in the FullName field. 135.El 136.Pp 137The 138.Ar login 139field is the user name used to access the computer account. 140.Pp 141The 142.Ar password 143field contains the encrypted form of the user's password. 144.Pp 145The 146.Ar uid 147field is the number associated with the 148.Ar login 149field. 150Both of these fields should be unique across the system (and often 151across a group of systems) as they control file access. 152.Pp 153While it is possible to have multiple entries with identical login names 154and/or identical user id's, it is usually a mistake to do so. Routines 155that manipulate these files will often return only one of the multiple 156entries, and that one by random selection. 157.Pp 158The 159.Ar group 160field is the group that the user will be placed in at login. 161Since BSD supports multiple groups (see 162.Xr groups 1 ) 163this field currently has little special meaning. 164This field may be filled in with either a number or a group name (see 165.Xr group 5 ) . 166.Pp 167The 168.Ar class 169field references class descriptions in 170.Pa /etc/login.conf 171and is typically used to initialize the user's system resource limits 172when they login. 173.Pp 174The 175.Ar change 176field is the date by which the password must be changed. 177.Pp 178The 179.Ar expire 180field is the date on which the account expires. 181.Pp 182Both the 183.Ar change 184and 185.Ar expire 186fields should be entered in the form 187.Dq month day year 188where 189.Ar month 190is the month name (the first three characters are sufficient), 191.Ar day 192is the day of the month, and 193.Ar year 194is the year. 195.Pp 196Five fields are available for storing the user's 197.Ar full name , office location , 198.Ar work 199and 200.Ar home telephone 201numbers and finally 202.Ar other information 203which is a single comma delimited string to represent any additional 204gcos fields (typically used for site specific user information). 205Note that 206.Xr finger 1 207will display the office location and office phone together under the 208heading 209.Ar Office: . 210.Pp 211The user's 212.Ar home directory 213is the full 214.Ux 215path name where the user 216will be placed at login. 217.Pp 218The 219.Ar shell 220field is the command interpreter the user prefers. 221If the 222.Ar shell 223field is empty, the Bourne shell, 224.Pa /bin/sh , 225is assumed. 226When altering a login shell, and not the super-user, the user 227may not change from a non-standard shell or to a non-standard 228shell. 229Non-standard is defined as a shell not found in 230.Pa /etc/shells . 231.Pp 232Once the information has been verified, 233.Nm 234uses 235.Xr pwd_mkdb 8 236to update the user database. 237.Sh ENVIRONMENT 238The 239.Xr vi 1 240editor will be used unless the environment variable 241.Ev EDITOR 242is set to 243an alternate editor. 244When the editor terminates, the information is re-read and used to 245update the user database itself. 246Only the user, or the super-user, may edit the information associated 247with the user. 248.Pp 249See 250.Xr pwd_mkdb 8 251for an explanation of the impact of setting the 252.Ev PW_SCAN_BIG_IDS 253environment variable. 254.Sh NIS INTERACTION 255.Nm Chpass 256can also be used in conjunction with NIS, however some restrictions 257apply. 258Currently, 259.Nm 260can only make changes to the NIS passwd maps through 261.Xr rpc.yppasswdd 8 , 262which normally only permits changes to a user's password, shell and GECOS 263fields. 264Except when invoked by the super-user on the NIS master server, 265.Nm 266(and, similarly, 267.Xr passwd 1 ) 268can not use the 269.Xr rpc.yppasswdd 8 270server to change other user information or 271add new records to the NIS passwd maps. 272Furthermore, 273.Xr rpc.yppasswdd 8 274requires password authentication before it will make any 275changes. 276The only user allowed to submit changes without supplying 277a password is the super-user on the NIS master server; all other users, 278including those with root privileges on NIS clients (and NIS slave 279servers) must enter a password. 280(The super-user on the NIS master is allowed to bypass these restrictions 281largely for convenience: a user with root access 282to the NIS master server already has the privileges required to make 283updates to the NIS maps, but editing the map source files by hand can 284be cumbersome. 285.Pp 286Note: these exceptions only apply when the NIS master server is a 287.Fx 288system). 289.Pp 290Consequently, except where noted, the following restrictions apply when 291.Nm 292is used with NIS: 293.Bl -enum -offset indent 294.It 295.Em "Only the shell and GECOS information may be changed" . 296All other 297fields are restricted, even when 298.Nm 299is invoked by the super-user. 300While support for 301changing other fields could be added, this would lead to 302compatibility problems with other NIS-capable systems. 303Even though the super-user may supply data for other fields 304while editing an entry, the extra information (other than the 305password -- see below) will be silently discarded. 306.Pp 307Exception: the super-user on the NIS master server is permitted to 308change any field. 309.Pp 310.It 311.Em "Password authentication is required" . 312.Nm Chpass 313will prompt for the user's NIS password before effecting 314any changes. 315If the password is invalid, all changes will be 316discarded. 317.Pp 318Exception: the super-user on the NIS master server is allowed to 319submit changes without supplying a password. 320(The super-user may 321choose to turn off this feature using the 322.Fl o 323flag, described below.) 324.It 325.Em "Adding new records to the local password database is discouraged" . 326.Nm Chpass 327will allow the administrator to add new records to the 328local password database while NIS is enabled, but this can lead to 329some confusion since the new records are appended to the end of 330the master password file, usually after the special NIS '+' entries. 331The administrator should use 332.Xr vipw 8 333to modify the local password 334file when NIS is running. 335.Pp 336The super-user on the NIS master server is permitted to add new records 337to the NIS password maps, provided the 338.Xr rpc.yppasswdd 8 339server has been started with the 340.Fl a 341flag to permitted additions (it refuses them by default). 342.Nm Chpass 343tries to update the local password database by default; to update the 344NIS maps instead, invoke chpass with the 345.Fl y 346flag. 347.It 348.Em "Password changes are not permitted". 349Users should use 350.Xr passwd 1 351or 352.Xr yppasswd 1 353to change their NIS passwords. 354The super-user is allowed to specify 355a new password (even though the 356.Dq Password: 357field does not show 358up in the editor template, the super-user may add it back by hand), 359but even the super-user must supply the user's original password 360otherwise 361.Xr rpc.yppasswdd 8 362will refuse to update the NIS maps. 363.Pp 364Exception: the super-user on the NIS master server is permitted to 365change a user's NIS password with 366.Nm . 367.El 368.Pp 369There are also a few extra option flags that are available when 370.Nm 371is compiled with NIS support: 372.Bl -tag -width indent 373.It Fl l 374Force 375.Nm 376to modify the local copy of a user's password 377information in the even that a user exists in both 378the local and NIS databases. 379.It Fl y 380Opposite effect of 381.Fl l . 382This flag is largely redundant since 383.Nm 384operates on NIS entries by default if NIS is enabled. 385.It Fl d Ar domain 386Specify a particular NIS domain. 387.Nm Chpass 388uses the system domain name by default, as set by the 389.Xr domainname 1 390command. 391The 392.Fl d 393option can be used to override a default, or to specify a domain 394when the system domain name is not set. 395.It Fl h Ar host 396Specify the name or address of an NIS server to query. 397Normally, 398.Nm 399will communicate with the NIS master host specified in the 400.Pa master.passwd 401or 402.Pa passwd 403maps. 404On hosts that have not been configured as NIS clients, there is 405no way for the program to determine this information unless the user 406provides the hostname of a server. 407Note that the specified hostname need 408not be that of the NIS master server; the name of any server, master or 409slave, in a given NIS domain will do. 410.Pp 411When using the 412.Fl d 413option, the hostname defaults to 414.Dq localhost . 415The 416.Fl h 417option can be used in conjunction with the 418.Fl d 419option, in which case the user-specified hostname will override 420the default. 421.Pp 422.It Fl o 423Force the use of RPC-based updates when communicating with 424.Xr rpc.yppasswdd 8 425.Pq Dq old-mode . 426When invoked by the super-user on the NIS master server, 427.Nm 428allows unrestricted changes to the NIS passwd maps using dedicated, 429non-RPC-based mechanism (in this case, a 430.Ux 431domain socket). The 432.Fl o 433flag can be used to force 434.Nm 435to use the standard update mechanism instead. 436This option is provided 437mainly for testing purposes. 438.El 439.Pp 440.Sh FILES 441.Bl -tag -width /etc/master.passwd -compact 442.It Pa /etc/master.passwd 443the user database 444.It Pa /etc/passwd 445a Version 7 format password file 446.It Pa /etc/chpass.XXXXXX 447temporary copy of the password file 448.It Pa /etc/shells 449the list of approved shells 450.El 451.Sh SEE ALSO 452.Xr finger 1 , 453.Xr login 1 , 454.Xr passwd 1 , 455.Xr getusershell 3 , 456.Xr login.conf 5 , 457.Xr passwd 5 , 458.Xr pwd_mkdb 8 , 459.Xr vipw 8 460.Rs 461.%A Robert Morris 462and 463.%A Ken Thompson 464.%T "UNIX Password security" 465.Re 466.Sh NOTES 467The 468.Xr chfn 1 , 469.Xr chsh 1 , 470.Xr ypchpass 1 , 471.Xr ypchfn 1 472and 473.Xr ypchsh 1 474commands are really only links to 475.Nm . 476.Sh BUGS 477User information should (and eventually will) be stored elsewhere. 478.Sh HISTORY 479The 480.Nm 481command appeared in 482.Bx 4.3 Reno . 483