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           The change of the group ownership of files inside of the user's
65           home directory is also not done if the home dir owner uid is
66           different from the current or new user id. This is safety measure
67           for special home directories such as /.
68
69       -G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
70           A list of supplementary groups which the user is also a member of.
71           Each group is separated from the next by a comma, with no
72           intervening whitespace. The groups are subject to the same
73           restrictions as the group given with the -g option.
74
75           If the user is currently a member of a group which is not listed,
76           the user will be removed from the group. This behaviour can be
77           changed via the -a option, which appends the user to the current
78           supplementary group list.
79
80       -l, --login NEW_LOGIN
81           The name of the user will be changed from LOGIN to NEW_LOGIN.
82           Nothing else is changed. In particular, the user's home directory
83           or mail spool should probably be renamed manually to reflect the
84           new login name.
85
86       -L, --lock
87           Lock a user's password. This puts a '!' in front of the encrypted
88           password, effectively disabling the password. You can't use this
89           option with -p or -U.
90
91           Note: if you wish to lock the account (not only access with a
92           password), you should also set the EXPIRE_DATE to 1.
93
94       -m, --move-home
95           Move the content of the user's home directory to the new location.
96           If the current home directory does not exist the new home directory
97           will not be created.
98
99           This option is only valid in combination with the -d (or --home)
100           option.
101
102           usermod will try to adapt the ownership of the files and to copy
103           the modes, ACL and extended attributes, but manual changes might be
104           needed afterwards.
105
106       -o, --non-unique
107           When used with the -u option, this option allows to change the user
108           ID to a non-unique value.
109
110       -p, --password PASSWORD
111           The encrypted password, as returned by crypt(3).
112
113           Note: This option is not recommended because the password (or
114           encrypted password) will be visible by users listing the processes.
115
116           You should make sure the password respects the system's password
117           policy.
118
119       -R, --root CHROOT_DIR
120           Apply changes in the CHROOT_DIR directory and use the configuration
121           files from the CHROOT_DIR directory.
122
123       -P, --prefix PREFIX_DIR
124           Apply changes in the PREFIX_DIR directory and use the configuration
125           files from the PREFIX_DIR directory. This option does not chroot
126           and is intended for preparing a cross-compilation target. Some
127           limitations: NIS and LDAP users/groups are not verified. PAM
128           authentication is using the host files. No SELINUX support.
129
130       -s, --shell SHELL
131           The name of the user's new login shell. Setting this field to blank
132           causes the system to select the default login shell.
133
134       -u, --uid UID
135           The new numerical value of the user's ID.
136
137           This value must be unique, unless the -o option is used. The value
138           must be non-negative.
139
140           The user's mailbox, and any files which the user owns and which are
141           located in the user's home directory will have the file user ID
142           changed automatically.
143
144           The ownership of files outside of the user's home directory must be
145           fixed manually.
146
147           The change of the user ownership of files inside of the user's home
148           directory is also not done if the home dir owner uid is different
149           from the current or new user id. This is safety measure for special
150           home directories such as /.
151
152           No checks will be performed with regard to the UID_MIN, UID_MAX,
153           SYS_UID_MIN, or SYS_UID_MAX from /etc/login.defs.
154
155       -U, --unlock
156           Unlock a user's password. This removes the '!' in front of the
157           encrypted password. You can't use this option with -p or -L.
158
159           Note: if you wish to unlock the account (not only access with a
160           password), you should also set the EXPIRE_DATE (for example to
161           99999, or to the EXPIRE value from /etc/default/useradd).
162
163       -v, --add-subuids FIRST-LAST
164           Add a range of subordinate uids to the user's account.
165
166           This option may be specified multiple times to add multiple ranges
167           to a users account.
168
169           No checks will be performed with regard to SUB_UID_MIN,
170           SUB_UID_MAX, or SUB_UID_COUNT from /etc/login.defs.
171
172       -V, --del-subuids FIRST-LAST
173           Remove a range of subordinate uids from the user's account.
174
175           This option may be specified multiple times to remove multiple
176           ranges to a users account. When both --del-subuids and
177           --add-subuids are specified, the removal of all subordinate uid
178           ranges happens before any subordinate uid range is added.
179
180           No checks will be performed with regard to SUB_UID_MIN,
181           SUB_UID_MAX, or SUB_UID_COUNT from /etc/login.defs.
182
183       -w, --add-subgids FIRST-LAST
184           Add a range of subordinate gids to the user's account.
185
186           This option may be specified multiple times to add multiple ranges
187           to a users account.
188
189           No checks will be performed with regard to SUB_GID_MIN,
190           SUB_GID_MAX, or SUB_GID_COUNT from /etc/login.defs.
191
192       -W, --del-subgids FIRST-LAST
193           Remove a range of subordinate gids from the user's account.
194
195           This option may be specified multiple times to remove multiple
196           ranges to a users account. When both --del-subgids and
197           --add-subgids are specified, the removal of all subordinate gid
198           ranges happens before any subordinate gid range is added.
199
200           No checks will be performed with regard to SUB_GID_MIN,
201           SUB_GID_MAX, or SUB_GID_COUNT from /etc/login.defs.
202
203       -Z, --selinux-user SEUSER
204           The new SELinux user for the user's login.
205
206           A blank SEUSER will remove the SELinux user mapping for user LOGIN
207           (if any).
208

CAVEATS

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

CONFIGURATION

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

FILES

276       /etc/group
277           Group account information.
278
279       /etc/gshadow
280           Secure group account information.
281
282       /etc/login.defs
283           Shadow password suite configuration.
284
285       /etc/passwd
286           User account information.
287
288       /etc/shadow
289           Secure user account information.
290
291       /etc/subgid
292           Per user subordinate group IDs.
293
294       /etc/subuid
295           Per user subordinate user IDs.
296

SEE ALSO

298       chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8),
299       groupdel(8), groupmod(8), login.defs(5), subgid(5), subuid(5),
300       useradd(8), userdel(8).
301
302
303
304shadow-utils 4.6                  05/11/2019                        USERMOD(8)
Impressum