1USERMOD(8)                System Management Commands                USERMOD(8)
2
3
4

NAME

6       usermod - modify a user account
7

SYNOPSIS

9       usermod [options] LOGIN
10

DESCRIPTION

12       The usermod command modifies the system account files to reflect the
13       changes that are specified on the command line.
14

OPTIONS

16       The options which apply to the usermod command are:
17
18       -a, --append
19           Add the user to the supplementary group(s). Use only with the -G
20           option.
21
22       -c, --comment COMMENT
23           The new value of the user's password file comment field. It is
24           normally modified using the chfn(1) utility.
25
26       -d, --home HOME_DIR
27           The user's new login directory.
28
29           If the -m option is given, the contents of the current home
30           directory will be moved to the new home directory, which is created
31           if it does not already exist. If the current home directory does
32           not exist the new home directory will not be created.
33
34       -e, --expiredate EXPIRE_DATE
35           The date on which the user account will be disabled. The date is
36           specified in the format YYYY-MM-DD.
37
38           An empty EXPIRE_DATE argument will disable the expiration of the
39           account.
40
41           This option requires a /etc/shadow file. A /etc/shadow entry will
42           be created if there were none.
43
44       -f, --inactive INACTIVE
45           The number of days after a password expires until the account is
46           permanently disabled.
47
48           A value of 0 disables the account as soon as the password has
49           expired, and a value of -1 disables the feature.
50
51           This option requires a /etc/shadow file. A /etc/shadow entry will
52           be created if there were none.
53
54       -g, --gid GROUP
55           The group name or number of the user's new initial login group. The
56           group must exist.
57
58           Any file from the user's home directory owned by the previous
59           primary group of the user will be owned by this new group.
60
61           The group ownership of files outside of the user's home directory
62           must be fixed manually.
63
64       -G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
65           A list of supplementary groups which the user is also a member of.
66           Each group is separated from the next by a comma, with no
67           intervening whitespace. The groups are subject to the same
68           restrictions as the group given with the -g option.
69
70           If the user is currently a member of a group which is not listed,
71           the user will be removed from the group. This behaviour can be
72           changed via the -a option, which appends the user to the current
73           supplementary group list.
74
75       -l, --login NEW_LOGIN
76           The name of the user will be changed from LOGIN to NEW_LOGIN.
77           Nothing else is changed. In particular, the user's home directory
78           or mail spool should probably be renamed manually to reflect the
79           new login name.
80
81       -L, --lock
82           Lock a user's password. This puts a '!' in front of the encrypted
83           password, effectively disabling the password. You can't use this
84           option with -p or -U.
85
86           Note: if you wish to lock the account (not only access with a
87           password), you should also set the EXPIRE_DATE to 1.
88
89       -m, --move-home
90           Move the content of the user's home directory to the new location.
91           If the current home directory does not exist the new home directory
92           will not be created.
93
94           This option is only valid in combination with the -d (or --home)
95           option.
96
97           usermod will try to adapt the ownership of the files and to copy
98           the modes, ACL and extended attributes, but manual changes might be
99           needed afterwards.
100
101       -o, --non-unique
102           When used with the -u option, this option allows to change the user
103           ID to a non-unique value.
104
105       -p, --password PASSWORD
106           The encrypted password, as returned by crypt(3).
107
108           Note: This option is not recommended because the password (or
109           encrypted password) will be visible by users listing the processes.
110
111           You should make sure the password respects the system's password
112           policy.
113
114       -R, --root CHROOT_DIR
115           Apply changes in the CHROOT_DIR directory and use the configuration
116           files from the CHROOT_DIR directory.
117
118       -P, --prefix PREFIX_DIR
119           Apply changes in the PREFIX_DIR directory and use the configuration
120           files from the PREFIX_DIR directory. This option does not chroot
121           and is intended for preparing a cross-compilation target. Some
122           limitations: NIS and LDAP users/groups are not verified. PAM
123           authentication is using the host files. No SELINUX support.
124
125       -s, --shell SHELL
126           The name of the user's new login shell. Setting this field to blank
127           causes the system to select the default login shell.
128
129       -u, --uid UID
130           The new numerical value of the user's ID.
131
132           This value must be unique, unless the -o option is used. The value
133           must be non-negative.
134
135           The user's mailbox, and any files which the user owns and which are
136           located in the user's home directory will have the file user ID
137           changed automatically.
138
139           The ownership of files outside of the user's home directory must be
140           fixed manually.
141
142           No checks will be performed with regard to the UID_MIN, UID_MAX,
143           SYS_UID_MIN, or SYS_UID_MAX from /etc/login.defs.
144
145       -U, --unlock
146           Unlock a user's password. This removes the '!' in front of the
147           encrypted password. You can't use this option with -p or -L.
148
149           Note: if you wish to unlock the account (not only access with a
150           password), you should also set the EXPIRE_DATE (for example to
151           99999, or to the EXPIRE value from /etc/default/useradd).
152
153       -v, --add-subuids FIRST-LAST
154           Add a range of subordinate uids to the user's account.
155
156           This option may be specified multiple times to add multiple ranges
157           to a users account.
158
159           No checks will be performed with regard to SUB_UID_MIN,
160           SUB_UID_MAX, or SUB_UID_COUNT from /etc/login.defs.
161
162       -V, --del-subuids FIRST-LAST
163           Remove a range of subordinate uids from the user's account.
164
165           This option may be specified multiple times to remove multiple
166           ranges to a users account. When both --del-subuids and
167           --add-subuids are specified, the removal of all subordinate uid
168           ranges happens before any subordinate uid range is added.
169
170           No checks will be performed with regard to SUB_UID_MIN,
171           SUB_UID_MAX, or SUB_UID_COUNT from /etc/login.defs.
172
173       -w, --add-subgids FIRST-LAST
174           Add a range of subordinate gids to the user's account.
175
176           This option may be specified multiple times to add multiple ranges
177           to a users account.
178
179           No checks will be performed with regard to SUB_GID_MIN,
180           SUB_GID_MAX, or SUB_GID_COUNT from /etc/login.defs.
181
182       -W, --del-subgids FIRST-LAST
183           Remove a range of subordinate gids from the user's account.
184
185           This option may be specified multiple times to remove multiple
186           ranges to a users account. When both --del-subgids and
187           --add-subgids are specified, the removal of all subordinate gid
188           ranges happens before any subordinate gid range is added.
189
190           No checks will be performed with regard to SUB_GID_MIN,
191           SUB_GID_MAX, or SUB_GID_COUNT from /etc/login.defs.
192
193       -Z, --selinux-user SEUSER
194           The new SELinux user for the user's login.
195
196           A blank SEUSER will remove the SELinux user mapping for user LOGIN
197           (if any).
198

CAVEATS

200       You must make certain that the named user is not executing any
201       processes when this command is being executed if the user's numerical
202       user ID, the user's name, or the user's home directory is being
203       changed.  usermod checks this on Linux. On other platforms it only uses
204       utmp to check if the user is logged in.
205
206       You must change the owner of any crontab files or at jobs manually.
207
208       You must make any changes involving NIS on the NIS server.
209

CONFIGURATION

211       The following configuration variables in /etc/login.defs change the
212       behavior of this tool:
213
214       MAIL_DIR (string)
215           The mail spool directory. This is needed to manipulate the mailbox
216           when its corresponding user account is modified or deleted. If not
217           specified, a compile-time default is used.
218
219       MAIL_FILE (string)
220           Defines the location of the users mail spool files relatively to
221           their home directory.
222
223       The MAIL_DIR and MAIL_FILE variables are used by useradd, usermod, and
224       userdel to create, move, or delete the user's mail spool.
225
226       If MAIL_CHECK_ENAB is set to yes, they are also used to define the MAIL
227       environment variable.
228
229       MAX_MEMBERS_PER_GROUP (number)
230           Maximum members per group entry. When the maximum is reached, a new
231           group entry (line) is started in /etc/group (with the same name,
232           same password, and same GID).
233
234           The default value is 0, meaning that there are no limits in the
235           number of members in a group.
236
237           This feature (split group) permits to limit the length of lines in
238           the group file. This is useful to make sure that lines for NIS
239           groups are not larger than 1024 characters.
240
241           If you need to enforce such limit, you can use 25.
242
243           Note: split groups may not be supported by all tools (even in the
244           Shadow toolsuite). You should not use this variable unless you
245           really need it.
246
247       SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)
248           If /etc/subuid exists, the commands useradd and newusers (unless
249           the user already have subordinate group IDs) allocate SUB_GID_COUNT
250           unused group IDs from the range SUB_GID_MIN to SUB_GID_MAX for each
251           new user.
252
253           The default values for SUB_GID_MIN, SUB_GID_MAX, SUB_GID_COUNT are
254           respectively 100000, 600100000 and 10000.
255
256       SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)
257           If /etc/subuid exists, the commands useradd and newusers (unless
258           the user already have subordinate user IDs) allocate SUB_UID_COUNT
259           unused user IDs from the range SUB_UID_MIN to SUB_UID_MAX for each
260           new user.
261
262           The default values for SUB_UID_MIN, SUB_UID_MAX, SUB_UID_COUNT are
263           respectively 100000, 600100000 and 10000.
264

FILES

266       /etc/group
267           Group account information.
268
269       /etc/gshadow
270           Secure group account information.
271
272       /etc/login.defs
273           Shadow password suite configuration.
274
275       /etc/passwd
276           User account information.
277
278       /etc/shadow
279           Secure user account information.
280
281       /etc/subgid
282           Per user subordinate group IDs.
283
284       /etc/subuid
285           Per user subordinate user IDs.
286

SEE ALSO

288       chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8),
289       groupdel(8), groupmod(8), login.defs(5), subgid(5), subuid(5),
290       useradd(8), userdel(8).
291
292
293
294shadow-utils 4.6                  11/08/2018                        USERMOD(8)
Impressum