1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (c) 1991 - 1994, Julianne Frances Haugh
4 Copyright (c) 2007 - 2011, Nicolas François
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. The name of the copyright holders or contributors may not be used to
16 endorse or promote products derived from this software without
17 specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
32 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
33 <!ENTITY MAIL_DIR SYSTEM "login.defs.d/MAIL_DIR.xml">
34 <!ENTITY MAX_MEMBERS_PER_GROUP SYSTEM "login.defs.d/MAX_MEMBERS_PER_GROUP.xml">
35 <!ENTITY TCB_SYMLINKS SYSTEM "login.defs.d/TCB_SYMLINKS.xml">
36 <!ENTITY USE_TCB SYSTEM "login.defs.d/USE_TCB.xml">
37 <!-- SHADOW-CONFIG-HERE -->
39 <refentry id='usermod.8'>
42 <refentrytitle>usermod</refentrytitle>
43 <manvolnum>8</manvolnum>
44 <refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
45 <refmiscinfo class="source">shadow-utils</refmiscinfo>
46 <refmiscinfo class="version">&SHADOW_UTILS_VERSION;</refmiscinfo>
48 <refnamediv id='name'>
49 <refname>usermod</refname>
50 <refpurpose>modify a user account</refpurpose>
53 <refsynopsisdiv id='synopsis'>
55 <command>usermod</command>
57 <replaceable>options</replaceable>
59 <arg choice='plain'><replaceable>LOGIN</replaceable></arg>
63 <refsect1 id='description'>
64 <title>DESCRIPTION</title>
66 The <command>usermod</command> command modifies the system account
67 files to reflect the changes that are specified on the command line.
71 <refsect1 id='options'>
72 <title>OPTIONS</title>
74 The options which apply to the <command>usermod</command> command
80 <option>-a</option>, <option>--append</option>
84 Add the user to the supplementary group(s). Use only with the
85 <option>-G</option> option.
91 <option>-c</option>, <option>--comment</option>
92 <replaceable>COMMENT</replaceable>
96 The new value of the user's password file comment field. It is
97 normally modified using the <citerefentry>
98 <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
99 </citerefentry> utility.
105 <option>-d</option>, <option>--home</option>
106 <replaceable>HOME_DIR</replaceable>
110 The user's new login directory.
113 If the <option>-m</option>
114 option is given, the contents of the current home directory will
115 be moved to the new home directory, which is created if it does
122 <option>-e</option>, <option>--expiredate</option>
123 <replaceable>EXPIRE_DATE</replaceable>
127 The date on which the user account will be disabled. The date is
128 specified in the format <emphasis remap='I'>YYYY-MM-DD</emphasis>.
131 An empty <replaceable>EXPIRE_DATE</replaceable> argument will
132 disable the expiration of the account.
135 This option requires a <filename>/etc/shadow</filename> file.
136 A <filename>/etc/shadow</filename> entry will be created if
143 <option>-f</option>, <option>--inactive</option>
144 <replaceable>INACTIVE</replaceable>
148 The number of days after a password expires until the account is
149 permanently disabled.
152 A value of 0 disables the account as soon
153 as the password has expired, and a value of -1 disables the
157 This option requires a <filename>/etc/shadow</filename> file.
158 A <filename>/etc/shadow</filename> entry will be created if
165 <option>-g</option>, <option>--gid</option>
166 <replaceable>GROUP</replaceable>
170 The group name or number of the user's new initial login group.
171 The group must exist.
174 Any file from the user's home directory owned by the previous
175 primary group of the user will be owned by this new group.
178 The group ownership of files outside of the user's home directory
179 must be fixed manually.
185 <option>-G</option>, <option>--groups</option>
186 <replaceable>GROUP1</replaceable>[<emphasis remap='I'>,GROUP2,...</emphasis>[<emphasis remap='I'>,GROUPN</emphasis>]]]
190 A list of supplementary groups which the user is also a member
191 of. Each group is separated from the next by a comma, with no
192 intervening whitespace. The groups are subject to the same
193 restrictions as the group given with the <option>-g</option>
197 If the user is currently a member of a group which is
198 not listed, the user will be removed from the group. This
199 behaviour can be changed via the <option>-a</option> option, which
200 appends the user to the current supplementary group list.
206 <option>-l</option>, <option>--login</option>
207 <replaceable>NEW_LOGIN</replaceable>
211 The name of the user will be changed from
212 <replaceable>LOGIN</replaceable> to
213 <replaceable>NEW_LOGIN</replaceable>. Nothing else is changed. In
214 particular, the user's home directory or mail spool should
215 probably be renamed manually to reflect the new login name.
221 <option>-L</option>, <option>--lock</option>
225 Lock a user's password. This puts a '!' in front of the
226 encrypted password, effectively disabling the password. You
227 can't use this option with <option>-p</option> or
231 Note: if you wish to lock the account (not only access with a
232 password), you should also set the
233 <replaceable>EXPIRE_DATE</replaceable> to
234 <replaceable>1</replaceable>.
240 <option>-m</option>, <option>--move-home</option>
244 Move the content of the user's home directory to the new
248 This option is only valid in combination with the
249 <option>-d</option> (or <option>--home</option>) option.
252 <command>usermod</command> will try to adapt the ownership of the
253 files and to copy the modes, ACL and extended attributes, but
254 manual changes might be needed afterwards.
260 <option>-o</option>, <option>--non-unique</option>
264 When used with the <option>-u</option> option, this option
265 allows to change the user ID to a non-unique value.
271 <option>-p</option>, <option>--password</option>
272 <replaceable>PASSWORD</replaceable>
276 The encrypted password, as returned by <citerefentry>
277 <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
281 <emphasis role="bold">Note:</emphasis> This option is not
282 recommended because the password (or encrypted password) will
283 be visible by users listing the processes.
285 <para condition="pam">
286 The password will be written in the local
287 <filename>/etc/passwd</filename> or
288 <filename>/etc/shadow</filename> file. This might differ from the
289 password database configured in your PAM configuration.
292 You should make sure the password respects the system's
299 <option>-R</option>, <option>--root</option>
300 <replaceable>CHROOT_DIR</replaceable>
304 Apply changes in the <replaceable>CHROOT_DIR</replaceable>
305 directory and use the configuration files from the
306 <replaceable>CHROOT_DIR</replaceable> directory.
312 <option>-s</option>, <option>--shell</option>
313 <replaceable>SHELL</replaceable>
317 The name of the user's new login shell. Setting this field to
318 blank causes the system to select the default login shell.
324 <option>-u</option>, <option>--uid</option>
325 <replaceable>UID</replaceable>
329 The new numerical value of the user's ID.
332 This value must be unique,
333 unless the <option>-o</option> option is used. The value must be
334 non-negative. Values between 0 and 999 are typically reserved
338 The user's mailbox, and any files which the user owns and which are
339 located in the user's home
340 directory will have the file user ID changed automatically.
343 The ownership of files outside of the user's home directory
344 must be fixed manually.
350 <option>-U</option>, <option>--unlock</option>
354 Unlock a user's password. This removes the '!' in front of the
355 encrypted password. You can't use this option with
356 <option>-p</option> or <option>-L</option>.
359 Note: if you wish to unlock the account (not only access with a
360 password), you should also set the
361 <replaceable>EXPIRE_DATE</replaceable> (for example to
362 <replaceable>99999</replaceable>, or to the
363 <option>EXPIRE</option> value from
364 <filename>/etc/default/useradd</filename>).
370 <option>-Z</option>, <option>--selinux-user</option>
371 <replaceable>SEUSER</replaceable>
375 The SELinux user for the user's login. The default is to leave
376 this field the blank, which causes the system to select the
377 default SELinux user.
384 <refsect1 id='caveats'>
385 <title>CAVEATS</title>
387 You must make certain that the named user is
388 not executing any processes when this command is being executed if the
389 user's numerical user ID, the user's name, or the user's home
390 directory is being changed. <command>usermod</command> checks this
391 on Linux, but only check if the user is logged in according to utmp
392 on other architectures.
395 You must change the owner of any <command>crontab</command> files or
396 <command>at</command> jobs manually.
399 You must make any changes involving NIS on the NIS server.
403 <refsect1 id='configuration'>
404 <title>CONFIGURATION</title>
406 The following configuration variables in
407 <filename>/etc/login.defs</filename> change the behavior of this
411 &MAIL_DIR; <!-- documents also MAIL_FILE -->
412 &MAX_MEMBERS_PER_GROUP;
418 <refsect1 id='files'>
422 <term><filename>/etc/group</filename></term>
424 <para>Group account information.</para>
427 <varlistentry condition="gshadow">
428 <term><filename>/etc/gshadow</filename></term>
430 <para>Secure group account information.</para>
434 <term><filename>/etc/passwd</filename></term>
436 <para>User account information.</para>
440 <term><filename>/etc/shadow</filename></term>
442 <para>Secure user account information.</para>
448 <refsect1 id='see_also'>
449 <title>SEE ALSO</title>
452 <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
455 <refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum>
458 <refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
461 <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
464 <refentrytitle>gpasswd</refentrytitle><manvolnum>8</manvolnum>
467 <refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum>
470 <refentrytitle>groupdel</refentrytitle><manvolnum>8</manvolnum>
473 <refentrytitle>groupmod</refentrytitle><manvolnum>8</manvolnum>
476 <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
479 <refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum>
482 <refentrytitle>userdel</refentrytitle><manvolnum>8</manvolnum>