1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (c) 1991 - 1994, Julianne Frances Haugh
4 Copyright (c) 2007 - 2009, 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">
38 <refentry id='usermod.8'>
41 <refentrytitle>usermod</refentrytitle>
42 <manvolnum>8</manvolnum>
43 <refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
45 <refnamediv id='name'>
46 <refname>usermod</refname>
47 <refpurpose>modify a user account</refpurpose>
50 <refsynopsisdiv id='synopsis'>
52 <command>usermod</command>
54 <replaceable>options</replaceable>
56 <arg choice='plain'><replaceable>LOGIN</replaceable></arg>
60 <refsect1 id='description'>
61 <title>DESCRIPTION</title>
63 The <command>usermod</command> command modifies the system account
64 files to reflect the changes that are specified on the command line.
68 <refsect1 id='options'>
69 <title>OPTIONS</title>
71 The options which apply to the <command>usermod</command> command
77 <option>-a</option>, <option>--append</option>
81 Add the user to the supplementary group(s). Use only with the
82 <option>-G</option> option.
88 <option>-c</option>, <option>--comment</option>
89 <replaceable>COMMENT</replaceable>
93 The new value of the user's password file comment field. It is
94 normally modified using the <citerefentry>
95 <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
96 </citerefentry> utility.
102 <option>-d</option>, <option>--home</option>
103 <replaceable>HOME_DIR</replaceable>
107 The user's new login directory.
110 If the <option>-m</option>
111 option is given, the contents of the current home directory will
112 be moved to the new home directory, which is created if it does
119 <option>-e</option>, <option>--expiredate</option>
120 <replaceable>EXPIRE_DATE</replaceable>
124 The date on which the user account will be disabled. The date is
125 specified in the format <emphasis remap='I'>YYYY-MM-DD</emphasis>.
131 <option>-f</option>, <option>--inactive</option>
132 <replaceable>INACTIVE</replaceable>
136 The number of days after a password expires until the account is
137 permanently disabled.
140 A value of 0 disables the account as soon
141 as the password has expired, and a value of -1 disables the
148 <option>-g</option>, <option>--gid</option>
149 <replaceable>GROUP</replaceable>
153 The group name or number of the user's new initial login group.
154 The group must exist.
160 <option>-G</option>, <option>--groups</option>
161 <replaceable>GROUP1</replaceable>[<emphasis remap='I'>,GROUP2,...</emphasis>[<emphasis remap='I'>,GROUPN</emphasis>]]]
165 A list of supplementary groups which the user is also a member
166 of. Each group is separated from the next by a comma, with no
167 intervening whitespace. The groups are subject to the same
168 restrictions as the group given with the <option>-g</option>
172 If the user is currently a member of a group which is
173 not listed, the user will be removed from the group. This
174 behaviour can be changed via the <option>-a</option> option, which
175 appends the user to the current supplementary group list.
181 <option>-l</option>, <option>--login</option>
182 <replaceable>NEW_LOGIN</replaceable>
186 The name of the user will be changed from
187 <replaceable>LOGIN</replaceable> to
188 <replaceable>NEW_LOGIN</replaceable>. Nothing else is changed. In
189 particular, the user's home directory name should probably be
190 changed manually to reflect the new login name.
196 <option>-L</option>, <option>--lock</option>
200 Lock a user's password. This puts a '!' in front of the
201 encrypted password, effectively disabling the password. You
202 can't use this option with <option>-p</option> or
206 Note: if you wish to lock the account (not only access with a
207 password), you should also set the
208 <replaceable>EXPIRE_DATE</replaceable> to
209 <replaceable>1</replaceable>.
215 <option>-m</option>, <option>--move-home</option>
219 Move the content of the user's home directory to the new
223 This option is only valid in combination with the
224 <option>-d</option> (or <option>--home</option>) option.
227 <command>usermod</command> will try to adapt the ownership of the
228 files and to copy the modes, ACL and extended attributes, but
229 manual changes might be needed afterwards.
235 <option>-o</option>, <option>--non-unique</option>
239 When used with the <option>-u</option> option, this option
240 allows to change the user ID to a non-unique value.
246 <option>-p</option>, <option>--password</option>
247 <replaceable>PASSWORD</replaceable>
251 The encrypted password, as returned by <citerefentry>
252 <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
256 <emphasis role="bold">Note:</emphasis> This option is not
257 recommended because the password (or encrypted password) will
258 be visible by users listing the processes.
260 <para condition="pam">
261 The password will be written in the local
262 <filename>/etc/passwd</filename> or
263 <filename>/etc/shadow</filename> file. This might differ from the
264 password database configured in your PAM configuration.
267 You should make sure the password respects the system's
274 <option>-s</option>, <option>--shell</option>
275 <replaceable>SHELL</replaceable>
279 The name of the user's new login shell. Setting this field to
280 blank causes the system to select the default login shell.
286 <option>-u</option>, <option>--uid</option>
287 <replaceable>UID</replaceable>
291 The new numerical value of the user's ID.
294 This value must be unique,
295 unless the <option>-o</option> option is used. The value must be
296 non-negative. Values between 0 and 999 are typically reserved
300 The user's mailbox, and any files which the user owns and which are
301 located in the user's home
302 directory will have the file user ID changed automatically.
305 The ownership of files outside of the user's home directory
306 must be fixed manually.
312 <option>-U</option>, <option>--unlock</option>
316 Unlock a user's password. This removes the '!' in front of the
317 encrypted password. You can't use this option with
318 <option>-p</option> or <option>-L</option>.
321 Note: if you wish to unlock the account (not only access with a
322 password), you should also set the
323 <replaceable>EXPIRE_DATE</replaceable> (for example to
324 <replaceable>99999</replaceable>, or to the
325 <option>EXPIRE</option> value from
326 <filename>/etc/default/useradd</filename>).
332 <option>-Z</option>, <option>--selinux-user</option>
333 <replaceable>SEUSER</replaceable>
337 The SELinux user for the user's login. The default is to leave
338 this field the blank, which causes the system to select the
339 default SELinux user.
346 <refsect1 id='caveats'>
347 <title>CAVEATS</title>
349 You must make certain that the named user is
350 not executing any processes when this command is being executed if the
351 user's numerical user ID, the user's name, or the user's home
352 directory is being changed. <command>usermod</command> checks this
353 on Linux, but only check if the user is logged in according to utmp
354 on other architectures.
357 You must change the owner of any <command>crontab</command> files or
358 <command>at</command> jobs manually.
361 You must make any changes involving NIS on the NIS server.
365 <refsect1 id='configuration'>
366 <title>CONFIGURATION</title>
368 The following configuration variables in
369 <filename>/etc/login.defs</filename> change the behavior of this
373 &MAIL_DIR; <!-- documents also MAIL_FILE -->
374 &MAX_MEMBERS_PER_GROUP;
380 <refsect1 id='files'>
384 <term><filename>/etc/group</filename></term>
386 <para>Group account information.</para>
389 <varlistentry condition="gshadow">
390 <term><filename>/etc/gshadow</filename></term>
392 <para>Secure group account information.</para>
396 <term><filename>/etc/passwd</filename></term>
398 <para>User account information.</para>
402 <term><filename>/etc/shadow</filename></term>
404 <para>Secure user account information.</para>
410 <refsect1 id='see_also'>
411 <title>SEE ALSO</title>
414 <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
417 <refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum>
420 <refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
423 <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
426 <refentrytitle>gpasswd</refentrytitle><manvolnum>8</manvolnum>
429 <refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum>
432 <refentrytitle>groupdel</refentrytitle><manvolnum>8</manvolnum>
435 <refentrytitle>groupmod</refentrytitle><manvolnum>8</manvolnum>
438 <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
441 <refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum>
444 <refentrytitle>userdel</refentrytitle><manvolnum>8</manvolnum>