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