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
98           usermod will try to adapt the ownership of the files and to copy
99           the modes, ACL and extended attributes, but manual changes might be
100           needed afterwards.
101
102       -o, --non-unique
103           When used with the -u option, this option allows to change the user
104           ID to a non-unique value.
105
106       -p, --password PASSWORD
107           The encrypted password, as returned by crypt(3).
108
109
110           Note: This option is not recommended because the password (or
111           encrypted password) will be visible by users listing the processes.
112
113           You should make sure the password respects the system´s password
114           policy.
115
116       -R, --root CHROOT_DIR
117           Apply changes in the CHROOT_DIR directory and use the configuration
118           files from the CHROOT_DIR directory.
119
120       -s, --shell SHELL
121           The name of the user´s new login shell. Setting this field to blank
122           causes the system to select the default login shell.
123
124       -u, --uid UID
125           The new numerical value of the user´s ID.
126
127           This value must be unique, unless the -o option is used. The value
128           must be non-negative.
129
130           The user´s mailbox, and any files which the user owns and which are
131           located in the user´s home directory will have the file user ID
132           changed automatically.
133
134           The ownership of files outside of the user´s home directory must be
135           fixed manually.
136
137           No checks will be performed with regard to the UID_MIN, UID_MAX,
138           SYS_UID_MIN, or SYS_UID_MAX from /etc/login.defs.
139
140       -U, --unlock
141           Unlock a user´s password. This removes the ´!´ in front of the
142           encrypted password. You can´t use this option with -p or -L.
143
144           Note: if you wish to unlock the account (not only access with a
145           password), you should also set the EXPIRE_DATE (for example to
146           99999, or to the EXPIRE value from /etc/default/useradd).
147
148       -Z, --selinux-user SEUSER
149           The new SELinux user for the user´s login.
150
151           A blank SEUSER will remove the SELinux user mapping for user LOGIN
152           (if any).
153

CAVEATS

155       You must make certain that the named user is not executing any
156       processes when this command is being executed if the user´s numerical
157       user ID, the user´s name, or the user´s home directory is being
158       changed.  usermod checks this on Linux, but only check if the user is
159       logged in according to utmp on other architectures.
160
161       You must change the owner of any crontab files or at jobs manually.
162
163       You must make any changes involving NIS on the NIS server.
164

CONFIGURATION

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

FILES

203       /etc/group
204           Group account information.
205
206       /etc/gshadow
207           Secure group account information.
208
209       /etc/login.defs
210           Shadow password suite configuration.
211
212       /etc/passwd
213           User account information.
214
215       /etc/shadow
216           Secure user account information.
217

SEE ALSO

219       chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8),
220       groupdel(8), groupmod(8), login.defs(5), useradd(8), userdel(8).
221
222
223
224shadow-utils 4.1.5.1              05/10/2016                        USERMOD(8)
Impressum