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       -s, --shell SHELL
124           The name of the user's new login shell. Setting this field to blank
125           causes the system to select the default login shell.
126
127       -u, --uid UID
128           The new numerical value of the user's ID.
129
130           This value must be unique, unless the -o option is used. The value
131           must be non-negative.
132
133           The user's mailbox, and any files which the user owns and which are
134           located in the user's home directory will have the file user ID
135           changed automatically.
136
137           The ownership of files outside of the user's home directory must be
138           fixed manually.
139
140           The change of the user ownership of files inside of the user's home
141           directory is also not done if the home dir owner uid is different
142           from the current or new user id. This is safety measure for special
143           home directories such as /.
144
145           No checks will be performed with regard to the UID_MIN, UID_MAX,
146           SYS_UID_MIN, or SYS_UID_MAX from /etc/login.defs.
147
148       -U, --unlock
149           Unlock a user's password. This removes the '!' in front of the
150           encrypted password. You can't use this option with -p or -L.
151
152           Note: if you wish to unlock the account (not only access with a
153           password), you should also set the EXPIRE_DATE (for example to
154           99999, or to the EXPIRE value from /etc/default/useradd).
155
156       -Z, --selinux-user SEUSER
157           The new SELinux user for the user's login.
158
159           A blank SEUSER will remove the SELinux user mapping for user LOGIN
160           (if any).
161

CAVEATS

163       You must make certain that the named user is not executing any
164       processes when this command is being executed if the user's numerical
165       user ID, the user's name, or the user's home directory is being
166       changed.  usermod checks this on Linux, but only check if the user is
167       logged in according to utmp on other architectures.
168
169       You must change the owner of any crontab files or at jobs manually.
170
171       You must make any changes involving NIS on the NIS server.
172

CONFIGURATION

174       The following configuration variables in /etc/login.defs change the
175       behavior of this tool:
176
177       MAIL_DIR (string)
178           The mail spool directory. This is needed to manipulate the mailbox
179           when its corresponding user account is modified or deleted. If not
180           specified, a compile-time default is used.
181
182       MAIL_FILE (string)
183           Defines the location of the users mail spool files relatively to
184           their home directory.
185
186       The MAIL_DIR and MAIL_FILE variables are used by useradd, usermod, and
187       userdel to create, move, or delete the user's mail spool.
188
189       If MAIL_CHECK_ENAB is set to yes, they are also used to define the MAIL
190       environment variable.
191
192       MAX_MEMBERS_PER_GROUP (number)
193           Maximum members per group entry. When the maximum is reached, a new
194           group entry (line) is started in /etc/group (with the same name,
195           same password, and same GID).
196
197           The default value is 0, meaning that there are no limits in the
198           number of members in a group.
199
200           This feature (split group) permits to limit the length of lines in
201           the group file. This is useful to make sure that lines for NIS
202           groups are not larger than 1024 characters.
203
204           If you need to enforce such limit, you can use 25.
205
206           Note: split groups may not be supported by all tools (even in the
207           Shadow toolsuite). You should not use this variable unless you
208           really need it.
209

FILES

211       /etc/group
212           Group account information.
213
214       /etc/gshadow
215           Secure group account information.
216
217       /etc/login.defs
218           Shadow password suite configuration.
219
220       /etc/passwd
221           User account information.
222
223       /etc/shadow
224           Secure user account information.
225

SEE ALSO

227       chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8),
228       groupdel(8), groupmod(8), login.defs(5), useradd(8), userdel(8).
229
230
231
232shadow-utils 4.1.5.1              03/14/2019                        USERMOD(8)
Impressum