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

CAVEATS

213       You must make certain that the named user is not executing any
214       processes when this command is being executed if the user's numerical
215       user ID, the user's name, or the user's home directory is being
216       changed.  usermod checks this on Linux. On other platforms it only uses
217       utmp to check if the user is logged in.
218
219       You must change the owner of any crontab files or at jobs manually.
220
221       You must make any changes involving NIS on the NIS server.
222

CONFIGURATION

224       The following configuration variables in /etc/login.defs change the
225       behavior of this tool:
226
227       LASTLOG_UID_MAX (number)
228           Highest user ID number for which the lastlog entries should be
229           updated. As higher user IDs are usually tracked by remote user
230           identity and authentication services there is no need to create a
231           huge sparse lastlog file for them.
232
233           No LASTLOG_UID_MAX option present in the configuration means that
234           there is no user ID limit for writing lastlog entries.
235
236       MAIL_DIR (string)
237           The mail spool directory. This is needed to manipulate the mailbox
238           when its corresponding user account is modified or deleted. If not
239           specified, a compile-time default is used.
240
241       MAIL_FILE (string)
242           Defines the location of the users mail spool files relatively to
243           their home directory.
244
245       The MAIL_DIR and MAIL_FILE variables are used by useradd, usermod, and
246       userdel to create, move, or delete the user's mail spool.
247
248       If MAIL_CHECK_ENAB is set to yes, they are also used to define the MAIL
249       environment variable.
250
251       MAX_MEMBERS_PER_GROUP (number)
252           Maximum members per group entry. When the maximum is reached, a new
253           group entry (line) is started in /etc/group (with the same name,
254           same password, and same GID).
255
256           The default value is 0, meaning that there are no limits in the
257           number of members in a group.
258
259           This feature (split group) permits to limit the length of lines in
260           the group file. This is useful to make sure that lines for NIS
261           groups are not larger than 1024 characters.
262
263           If you need to enforce such limit, you can use 25.
264
265           Note: split groups may not be supported by all tools (even in the
266           Shadow toolsuite). You should not use this variable unless you
267           really need it.
268
269       SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)
270           If /etc/subuid exists, the commands useradd and newusers (unless
271           the user already have subordinate group IDs) allocate SUB_GID_COUNT
272           unused group IDs from the range SUB_GID_MIN to SUB_GID_MAX for each
273           new user.
274
275           The default values for SUB_GID_MIN, SUB_GID_MAX, SUB_GID_COUNT are
276           respectively 100000, 600100000 and 65536.
277
278       SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)
279           If /etc/subuid exists, the commands useradd and newusers (unless
280           the user already have subordinate user IDs) allocate SUB_UID_COUNT
281           unused user IDs from the range SUB_UID_MIN to SUB_UID_MAX for each
282           new user.
283
284           The default values for SUB_UID_MIN, SUB_UID_MAX, SUB_UID_COUNT are
285           respectively 100000, 600100000 and 65536.
286

FILES

288       /etc/group
289           Group account information.
290
291       /etc/gshadow
292           Secure group account information.
293
294       /etc/login.defs
295           Shadow password suite configuration.
296
297       /etc/passwd
298           User account information.
299
300       /etc/shadow
301           Secure user account information.
302
303       /etc/subgid
304           Per user subordinate group IDs.
305
306       /etc/subuid
307           Per user subordinate user IDs.
308

SEE ALSO

310       chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8),
311       groupdel(8), groupmod(8), login.defs(5), subgid(5), subuid(5),
312       useradd(8), userdel(8).
313
314
315
316shadow-utils 4.9                  11/19/2021                        USERMOD(8)
Impressum