xref: /freebsd/usr.bin/chpass/chpass.1 (revision 9207b4cff7b8d483f4dd3c62266c2b58819eb7f9)
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
162.Bx
163supports multiple groups (see
164.Xr groups 1 )
165this field currently has little special meaning.
166This field may be filled in with either a number or a group name (see
167.Xr group 5 ) .
168.Pp
169The
170.Ar class
171field references class descriptions in
172.Pa /etc/login.conf
173and is typically used to initialize the user's system resource limits
174when they login.
175.Pp
176The
177.Ar change
178field is the date by which the password must be changed.
179.Pp
180The
181.Ar expire
182field is the date on which the account expires.
183.Pp
184Both the
185.Ar change
186and
187.Ar expire
188fields should be entered in the form
189.Dq month day year
190where
191.Ar month
192is the month name (the first three characters are sufficient),
193.Ar day
194is the day of the month, and
195.Ar year
196is the year.
197.Pp
198Five fields are available for storing the user's
199.Ar full name , office location ,
200.Ar work
201and
202.Ar home telephone
203numbers and finally
204.Ar other information
205which is a single comma delimited string to represent any additional
206gcos fields (typically used for site specific user information).
207Note that
208.Xr finger 1
209will display the office location and office phone together under the
210heading
211.Ar Office: .
212.Pp
213The user's
214.Ar home directory
215is the full
216.Ux
217path name where the user
218will be placed at login.
219.Pp
220The
221.Ar shell
222field is the command interpreter the user prefers.
223If the
224.Ar shell
225field is empty, the Bourne shell,
226.Pa /bin/sh ,
227is assumed.
228When altering a login shell, and not the super-user, the user
229may not change from a non-standard shell or to a non-standard
230shell.
231Non-standard is defined as a shell not found in
232.Pa /etc/shells .
233.Pp
234Once the information has been verified,
235.Nm
236uses
237.Xr pwd_mkdb 8
238to update the user database.
239.Sh ENVIRONMENT
240The
241.Xr vi 1
242editor will be used unless the environment variable
243.Ev EDITOR
244is set to
245an alternate editor.
246When the editor terminates, the information is re-read and used to
247update the user database itself.
248Only the user, or the super-user, may edit the information associated
249with the user.
250.Pp
251See
252.Xr pwd_mkdb 8
253for an explanation of the impact of setting the
254.Ev PW_SCAN_BIG_IDS
255environment variable.
256.Sh NIS INTERACTION
257.Nm Chpass
258can also be used in conjunction with NIS, however some restrictions
259apply.
260Currently,
261.Nm
262can only make changes to the NIS passwd maps through
263.Xr rpc.yppasswdd 8 ,
264which normally only permits changes to a user's password, shell and GECOS
265fields.
266Except when invoked by the super-user on the NIS master server,
267.Nm
268(and, similarly,
269.Xr passwd 1 )
270cannot use the
271.Xr rpc.yppasswdd 8
272server to change other user information or
273add new records to the NIS passwd maps.
274Furthermore,
275.Xr rpc.yppasswdd 8
276requires password authentication before it will make any
277changes.
278The only user allowed to submit changes without supplying
279a password is the super-user on the NIS master server; all other users,
280including those with root privileges on NIS clients (and NIS slave
281servers) must enter a password.
282(The super-user on the NIS master is allowed to bypass these restrictions
283largely for convenience: a user with root access
284to the NIS master server already has the privileges required to make
285updates to the NIS maps, but editing the map source files by hand can
286be cumbersome.
287.Pp
288Note: these exceptions only apply when the NIS master server is a
289.Fx
290system).
291.Pp
292Consequently, except where noted, the following restrictions apply when
293.Nm
294is used with NIS:
295.Bl -enum -offset indent
296.It
297.Em "Only the shell and GECOS information may be changed" .
298All other
299fields are restricted, even when
300.Nm
301is invoked by the super-user.
302While support for
303changing other fields could be added, this would lead to
304compatibility problems with other NIS-capable systems.
305Even though the super-user may supply data for other fields
306while editing an entry, the extra information (other than the
307password -- see below) will be silently discarded.
308.Pp
309Exception: the super-user on the NIS master server is permitted to
310change any field.
311.Pp
312.It
313.Em "Password authentication is required" .
314.Nm Chpass
315will prompt for the user's NIS password before effecting
316any changes.
317If the password is invalid, all changes will be
318discarded.
319.Pp
320Exception: the super-user on the NIS master server is allowed to
321submit changes without supplying a password.
322(The super-user may
323choose to turn off this feature using the
324.Fl o
325flag, described below.)
326.It
327.Em "Adding new records to the local password database is discouraged" .
328.Nm Chpass
329will allow the administrator to add new records to the
330local password database while NIS is enabled, but this can lead to
331some confusion since the new records are appended to the end of
332the master password file, usually after the special NIS '+' entries.
333The administrator should use
334.Xr vipw 8
335to modify the local password
336file when NIS is running.
337.Pp
338The super-user on the NIS master server is permitted to add new records
339to the NIS password maps, provided the
340.Xr rpc.yppasswdd 8
341server has been started with the
342.Fl a
343flag to permitted additions (it refuses them by default).
344.Nm Chpass
345tries to update the local password database by default; to update the
346NIS maps instead, invoke chpass with the
347.Fl y
348flag.
349.It
350.Em "Password changes are not permitted".
351Users should use
352.Xr passwd 1
353or
354.Xr yppasswd 1
355to change their NIS passwords.
356The super-user is allowed to specify
357a new password (even though the
358.Dq Password:
359field does not show
360up in the editor template, the super-user may add it back by hand),
361but even the super-user must supply the user's original password
362otherwise
363.Xr rpc.yppasswdd 8
364will refuse to update the NIS maps.
365.Pp
366Exception: the super-user on the NIS master server is permitted to
367change a user's NIS password with
368.Nm .
369.El
370.Pp
371There are also a few extra option flags that are available when
372.Nm
373is compiled with NIS support:
374.Bl -tag -width indent
375.It Fl l
376Force
377.Nm
378to modify the local copy of a user's password
379information in the even that a user exists in both
380the local and NIS databases.
381.It Fl y
382Opposite effect of
383.Fl l .
384This flag is largely redundant since
385.Nm
386operates on NIS entries by default if NIS is enabled.
387.It Fl d Ar domain
388Specify a particular NIS domain.
389.Nm Chpass
390uses the system domain name by default, as set by the
391.Xr domainname 1
392command.
393The
394.Fl d
395option can be used to override a default, or to specify a domain
396when the system domain name is not set.
397.It Fl h Ar host
398Specify the name or address of an NIS server to query.
399Normally,
400.Nm
401will communicate with the NIS master host specified in the
402.Pa master.passwd
403or
404.Pa passwd
405maps.
406On hosts that have not been configured as NIS clients, there is
407no way for the program to determine this information unless the user
408provides the hostname of a server.
409Note that the specified hostname need
410not be that of the NIS master server; the name of any server, master or
411slave, in a given NIS domain will do.
412.Pp
413When using the
414.Fl d
415option, the hostname defaults to
416.Dq localhost .
417The
418.Fl h
419option can be used in conjunction with the
420.Fl d
421option, in which case the user-specified hostname will override
422the default.
423.Pp
424.It Fl o
425Force the use of RPC-based updates when communicating with
426.Xr rpc.yppasswdd 8
427.Pq Dq old-mode .
428When invoked by the super-user on the NIS master server,
429.Nm
430allows unrestricted changes to the NIS passwd maps using dedicated,
431non-RPC-based mechanism (in this case, a
432.Ux
433domain socket). The
434.Fl o
435flag can be used to force
436.Nm
437to use the standard update mechanism instead.
438This option is provided
439mainly for testing purposes.
440.El
441.Sh FILES
442.Bl -tag -width /etc/master.passwd -compact
443.It Pa /etc/master.passwd
444the user database
445.It Pa /etc/passwd
446a Version 7 format password file
447.It Pa /etc/chpass.XXXXXX
448temporary copy of the password file
449.It Pa /etc/shells
450the list of approved shells
451.El
452.Sh SEE ALSO
453.Xr finger 1 ,
454.Xr login 1 ,
455.Xr passwd 1 ,
456.Xr getusershell 3 ,
457.Xr login.conf 5 ,
458.Xr passwd 5 ,
459.Xr pwd_mkdb 8 ,
460.Xr vipw 8
461.Rs
462.%A Robert Morris
463and
464.%A Ken Thompson
465.%T "UNIX Password security"
466.Re
467.Sh NOTES
468The
469.Xr chfn 1 ,
470.Xr chsh 1 ,
471.Xr ypchpass 1 ,
472.Xr ypchfn 1
473and
474.Xr ypchsh 1
475commands are really only links to
476.Nm .
477.Sh BUGS
478User information should (and eventually will) be stored elsewhere.
479.Sh HISTORY
480The
481.Nm
482command appeared in
483.Bx 4.3 Reno .
484