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