1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
|
'\" te
.\" Copyright (c) 2018 Peter Tribble.
.\" Copyright 1989 AT&T Copyright (c) 2004, 2009, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH USERMOD 1M "Jan 7, 2018"
.SH NAME
usermod \- modify a user's login information on the system
.SH SYNOPSIS
.LP
.nf
\fBusermod\fR [\fB-u\fR \fIuid\fR [\fB-o\fR]] [\fB-g\fR \fIgroup\fR] [\fB-G\fR \fIgroup\fR[,\fIgroup\fR]...]
[\fB-d\fR \fIdir\fR [\fB-m\fR [\fB-z|-Z\fR]]] [\fB-s\fR \fIshell\fR] [\fB-c\fR \fIcomment\fR] [\fB-l\fR \fInew_name\fR]
[\fB-f\fR \fIinactive\fR] [\fB-e\fR \fIexpire\fR]
[\fB-A\fR \fIauthorization\fR[,\fIauthorization\fR]...]
[\fB-P\fR \fIprofile\fR[,\fIprofile\fR]...] [\fB-R\fR \fIrole\fR[,\fIrole\fR]...]
[\fB-K\fR \fIkey=value\fR] \fIlogin\fR
.fi
.SH DESCRIPTION
.LP
The \fBusermod\fR utility modifies a user's login definition on the system. It
changes the definition of the specified login and makes the appropriate
login-related system file and file system changes.
.sp
.LP
The system file entries created with this command have a limit of 512
characters per line. Specifying long arguments to several options can exceed
this limit.
.SH OPTIONS
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-A\fR \fIauthorization\fR\fR
.ad
.sp .6
.RS 4n
One or more comma separated authorizations as defined in \fBauth_attr\fR(4).
Only a user or role who has \fBgrant\fR rights to the \fBauthorization\fR can
assign it to an account. This replaces any existing authorization setting. If
an empty authorization list is specified, the existing setting is removed.
.RE
.sp
.ne 2
.na
\fB\fB-c\fR \fIcomment\fR\fR
.ad
.sp .6
.RS 4n
Specify a comment string. \fIcomment\fR can be any text string. It is generally
a short description of the login, and is currently used as the field for the
user's full name. This information is stored in the user's \fB/etc/passwd\fR
entry.
.RE
.sp
.ne 2
.na
\fB\fB-d\fR \fIdir\fR\fR
.ad
.sp .6
.RS 4n
Specify the new home directory of the user. It defaults to
\fIbase_dir/login\fR, where \fIbase_dir\fR is the base directory for new login
home directories, and \fBlogin\fR is the new login.
.RE
.sp
.ne 2
.na
\fB\fB-e\fR \fIexpire\fR\fR
.ad
.sp .6
.RS 4n
Specify the expiration date for a login. After this date, no user will be able
to access this login. The expire option argument is a date entered using one of
the date formats included in the template file \fB/etc/datemsk\fR. See
\fBgetdate\fR(3C).
.sp
For example, you may enter \fB10/6/90\fR or \fBOctober 6, 1990\fR. A value of
\fB`` ''\fR defeats the status of the expired date.
.RE
.sp
.ne 2
.na
\fB\fB-f\fR \fIinactive\fR\fR
.ad
.sp .6
.RS 4n
Specify the maximum number of days allowed between uses of a login \fBID\fR
before that login \fBID\fR is declared invalid. Normal values are positive
integers. A value of \fB0\fR defeats the status.
.RE
.sp
.ne 2
.na
\fB\fB-g\fR \fIgroup\fR\fR
.ad
.sp .6
.RS 4n
Specify an existing group's integer \fBID\fR or character-string name. It
redefines the user's primary group membership.
.RE
.sp
.ne 2
.na
\fB\fB-G\fR \fIgroup\fR\fR
.ad
.sp .6
.RS 4n
One or more comma-separated existing groups, specified by integer \fBID\fR or
character-string name. It redefines the user's supplementary group membership.
Any duplicate groups between the \fB-g\fR and \fB-G\fR options are ignored.
No more than \fBNGROUPS_UMAX\fR groups may be specified as defined in
\fB<sys/param.h>\fR\&.
.RE
.sp
.ne 2
.na
\fB\fB-K\fR \fIkey=value\fR\fR
.ad
.sp .6
.RS 4n
Replace existing or add to a user's \fIkey=value\fR pair attributes. Multiple
\fB-K\fR options can be used to replace or add multiple \fIkey=value\fR pairs.
However, keys must not be repeated. The generic \fB-K\fR option with the
appropriate key can be used instead of the specific implied key options
(\fB-A\fR, \fB-P\fR, \fB-R\fR, \fB-p\fR). See \fBuser_attr\fR(4) for a list of
valid \fIkey\fRs. Values for these keys are usually found in man pages or other
sources related to those keys. For example, see \fBproject\fR(4) for guidance
on values for the \fBproject\fR key. Use the command \fBppriv\fR(1) with the
\fB-v\fR and \fB-l\fR options for a list of values for the keys
\fBdefaultpriv\fR and \fBlimitpriv\fR.
.sp
The keyword \fBtype\fR can be specified with the value \fBrole\fR or the value
\fBnormal\fR. When using the value \fBrole\fR, the account changes from a
normal user to a role; using the value \fBnormal\fR keeps the account a normal
user.
.sp
As a \fBrole\fR account, no roles (\fB-R\fR or \fIroles=value\fR) can be
present.
.RE
.sp
.ne 2
.na
\fB\fB-l\fR \fInew_logname\fR\fR
.ad
.sp .6
.RS 4n
Specify the new login name for the user. See \fBpasswd\fR(4) for the
requirements for usernames.
.RE
.sp
.ne 2
.na
\fB\fB-m\fR\fR [\fB-z|-Z\fR]
.ad
.sp .6
.RS 4n
Move the user's home directory to the new directory specified with the \fB-d\fR
option. If the directory already exists, it must have permissions
read/write/execute by \fIgroup\fR, where \fIgroup\fR is the user's primary
group.
.sp
If the user's old home directory was located on a separate \fBZFS\fR file system
and the \fB/etc/default/useradd\fR file contains the parameter \fBMANAGE_ZFS\fR
set to the value \fBYES\fR, the file system will be destroyed after the home
directory is moved. If the parent directory of the user's new home directory is
located on a separate \fBZFS\fR filesystem and the \fB/etc/default/useradd\fR
file contains the parameter \fBMANAGE_ZFS\fR set to the value \fBYES\fR, a new
\fBZFS\fR file system will be created.
.sp
If the \fB-z\fR option is specified, \fBusermod\fR will always try to create a
new file system for the home directory and destroy the old one.
.sp
If the \fB-Z\fR option is specified, a new file system will never be created,
and the old one will never be destroyed.
.RE
.sp
.ne 2
.na
\fB\fB-o\fR\fR
.ad
.sp .6
.RS 4n
This option allows the specified \fBUID\fR to be duplicated (non-unique).
.RE
.sp
.ne 2
.na
\fB\fB-P\fR \fIprofile\fR\fR
.ad
.sp .6
.RS 4n
One or more comma-separated execution profiles defined in \fBprof_attr\fR(4).
This replaces any existing profile setting in \fBuser_attr\fR(4). If an empty
profile list is specified, the existing setting is removed.
.RE
.sp
.ne 2
.na
\fB\fB-R\fR \fIrole\fR\fR
.ad
.sp .6
.RS 4n
One or more comma-separated roles (see \fBroleadd\fR(1M)). This replaces any
existing role setting. If an empty role list is specified, the existing setting
is removed.
.RE
.sp
.ne 2
.na
\fB\fB-s\fR \fIshell\fR\fR
.ad
.sp .6
.RS 4n
Specify the full pathname of the program that is used as the user's shell on
login. The value of \fIshell\fR must be a valid executable file.
.RE
.sp
.ne 2
.na
\fB\fB-u\fR \fIuid\fR\fR
.ad
.sp .6
.RS 4n
Specify a new \fBUID\fR for the user. It must be a non-negative decimal integer
less than \fBMAXUID\fR as defined in \fB<sys/param.h>\fR\&. The \fBUID\fR
associated with the user's home directory is not modified with this option; a
user will not have access to their home directory until the \fBUID\fR is
manually reassigned using \fBchown\fR(1).
.RE
.SH OPERANDS
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fBlogin\fR\fR
.ad
.sp .6
.RS 4n
An existing login name to be modified.
.RE
.SH EXAMPLES
.LP
\fBExample 1\fR Assigning Privileges to a User
.sp
.LP
The following command adds the privilege that affects high resolution times to
a user's initial, inheritable set of privileges.
.sp
.in +2
.nf
# \fBusermod -K defaultpriv=basic,proc_clock_highres jdoe\fR
.fi
.in -2
.sp
.sp
.LP
This command results in the following entry in \fBuser_attr\fR:
.sp
.in +2
.nf
jdoe::::type=normal;defaultpriv=basic,proc_clock_highres
.fi
.in -2
.LP
\fBExample 2\fR Removing a Privilege from a User's Limit Set
.sp
.LP
The following command removes the privilege that allows the specified user to
create hard links to directories and to unlink directories.
.sp
.in +2
.nf
# \fBusermod -K limitpriv=all,!sys_linkdir jdoe\fR
.fi
.in -2
.sp
.sp
.LP
This command results in the following entry in \fBuser_attr\fR:
.sp
.in +2
.nf
jdoe::::type=normal;defaultpriv=basic,limitpriv=all,!sys_linkdir
.fi
.in -2
.LP
\fBExample 3\fR Removing a Privilege from a User's Basic Set
.sp
.LP
The following command removes the privilege that allows the specified user to
examine processes outside the user's session.
.sp
.in +2
.nf
# \fBusermod -K defaultpriv=basic,!proc_session jdoe\fR
.fi
.in -2
.sp
.sp
.LP
This command results in the following entry in \fBuser_attr\fR:
.sp
.in +2
.nf
jdoe::::type=normal;defaultpriv=basic,!proc_session;limitpriv=all
.fi
.in -2
.LP
\fBExample 4\fR Assigning a Role to a User
.sp
.LP
The following command assigns a role to a user. The role must have been created
prior to this command, see \fBroleadd\fR(1M).
.sp
.in +2
.nf
# \fBusermod -R mailadm jdoe\fR
.fi
.in -2
.sp
.sp
.LP
This command results in the following entry in \fBuser_attr\fR:
.sp
.in +2
.nf
jdoe::::type=normal;roles=mailadm;defaultpriv=basic;limitpriv=all
.fi
.in -2
.LP
\fBExample 5\fR Removing All Profiles from a User
.sp
.LP
The following command removes all profiles that were granted to a user
directly. The user will still have any execution profiles that are granted by
means of the \fBPROFS_GRANTED\fR key in \fBpolicy.conf\fR(4).
.sp
.in +2
.nf
# \fBusermod -P "" jdoe\fR
.fi
.in -2
.sp
.SH EXIT STATUS
.LP
In case of an error, \fBusermod\fR prints an error message and exits with one
of the following values:
.sp
.ne 2
.na
\fB\fB2\fR\fR
.ad
.sp .6
.RS 4n
The command syntax was invalid. A usage message for the \fBusermod\fR command
is displayed.
.RE
.sp
.ne 2
.na
\fB\fB3\fR\fR
.ad
.sp .6
.RS 4n
An invalid argument was provided to an option.
.RE
.sp
.ne 2
.na
\fB\fB4\fR\fR
.ad
.sp .6
.RS 4n
The \fIuid\fR given with the \fB-u\fR option is already in use.
.RE
.sp
.ne 2
.na
\fB\fB5\fR\fR
.ad
.sp .6
.RS 4n
The password files contain an error. \fBpwconv\fR(1M) can be used to correct
possible errors. See \fBpasswd\fR(4).
.RE
.sp
.ne 2
.na
\fB\fB6\fR\fR
.ad
.sp .6
.RS 4n
The login to be modified does not exist, the \fIgroup\fR does not exist, or the
login shell does not exist.
.RE
.sp
.ne 2
.na
\fB\fB8\fR\fR
.ad
.sp .6
.RS 4n
The login to be modified is in use.
.RE
.sp
.ne 2
.na
\fB\fB9\fR\fR
.ad
.sp .6
.RS 4n
The \fInew_logname\fR is already in use.
.RE
.sp
.ne 2
.na
\fB\fB10\fR\fR
.ad
.sp .6
.RS 4n
Cannot update the \fB/etc/group\fR or \fB/etc/user_attr\fR file. Other update
requests will be implemented.
.RE
.sp
.ne 2
.na
\fB\fB11\fR\fR
.ad
.sp .6
.RS 4n
Insufficient space to move the home directory (\fB-m\fR option). Other update
requests will be implemented.
.RE
.sp
.ne 2
.na
\fB\fB12\fR\fR
.ad
.sp .6
.RS 4n
Unable to complete the move of the home directory to the new home directory.
.RE
.SH FILES
.ne 2
.na
\fB\fB/etc/default/useradd\fR\fR
.ad
.sp .6
.RS 4n
configuration file for user and role administrative commands
.RE
.sp
.ne 2
.na
\fB\fB/etc/group\fR\fR
.ad
.sp .6
.RS 4n
system file containing group definitions
.RE
.sp
.ne 2
.na
\fB\fB/etc/datemsk\fR\fR
.ad
.sp .6
.RS 4n
system file of date formats
.RE
.sp
.ne 2
.na
\fB\fB/etc/passwd\fR\fR
.ad
.sp .6
.RS 4n
system password file
.RE
.sp
.ne 2
.na
\fB\fB/etc/shadow\fR\fR
.ad
.sp .6
.RS 4n
system file containing users' and roles' encrypted passwords and related
information
.RE
.sp
.ne 2
.na
\fB\fB/etc/user_attr\fR\fR
.ad
.sp .6
.RS 4n
system file containing additional user and role attributes
.RE
.SH ATTRIBUTES
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Committed
.TE
.SH SEE ALSO
.LP
\fBchown\fR(1), \fBpasswd\fR(1), \fBgroupadd\fR(1M), \fBgroupdel\fR(1M),
\fBgroupmod\fR(1M), \fBlogins\fR(1M), \fBpwconv\fR(1M), \fBroleadd\fR(1M),
\fBroledel\fR(1M), \fBrolemod\fR(1M), \fBuseradd\fR(1M), \fBuserdel\fR(1M),
\fBzfs\fR(1M), \fBgetdate\fR(3C), \fBauth_attr\fR(4), \fBpasswd\fR(4),
\fBpolicy.conf\fR(4), \fBprof_attr\fR(4), \fBuser_attr\fR(4),
\fBattributes\fR(5)
.SH NOTES
.LP
The \fBusermod\fR utility modifies \fBpasswd\fR definitions only in the local
\fB/etc/passwd\fR and \fB/etc/shadow\fR files. If a network nameservice
is being used to supplement the local files with
additional entries, \fBusermod\fR cannot change information supplied by the
network nameservice. However \fBusermod\fR will verify the uniqueness of user
name and user \fBID\fR against the external nameservice.
.sp
.LP
The \fBusermod\fR utility uses the \fB/etc/datemsk\fR file
for date formatting.
|