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">
36 <refentry id='usermod.8'>
37 <!-- $Id: usermod.8.xml 2964 2009-05-21 12:02:12Z nekral-guest $ -->
39 <refentrytitle>usermod</refentrytitle>
40 <manvolnum>8</manvolnum>
41 <refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
43 <refnamediv id='name'>
44 <refname>usermod</refname>
45 <refpurpose>modify a user account</refpurpose>
48 <refsynopsisdiv id='synopsis'>
50 <command>usermod</command>
52 <replaceable>options</replaceable>
54 <arg choice='plain'><replaceable>LOGIN</replaceable></arg>
58 <refsect1 id='description'>
59 <title>DESCRIPTION</title>
61 The <command>usermod</command> command modifies the system account
62 files to reflect the changes that are specified on the command line.
66 <refsect1 id='options'>
67 <title>OPTIONS</title>
69 The options which apply to the <command>usermod</command> command
75 <option>-a</option>, <option>--append</option>
79 Add the user to the supplementary group(s). Use only with the
80 <option>-G</option> option.
86 <option>-c</option>, <option>--comment</option>
87 <replaceable>COMMENT</replaceable>
91 The new value of the user's password file comment field. It is
92 normally modified using the <citerefentry>
93 <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
94 </citerefentry> utility.
100 <option>-d</option>, <option>--home</option>
101 <replaceable>HOME_DIR</replaceable>
105 The user's new login directory.
108 If the <option>-m</option>
109 option is given, the contents of the current home directory will
110 be moved to the new home directory, which is created if it does
117 <option>-e</option>, <option>--expiredate</option>
118 <replaceable>EXPIRE_DATE</replaceable>
122 The date on which the user account will be disabled. The date is
123 specified in the format <emphasis remap='I'>YYYY-MM-DD</emphasis>.
129 <option>-f</option>, <option>--inactive</option>
130 <replaceable>INACTIVE</replaceable>
134 The number of days after a password expires until the account is
135 permanently disabled.
138 A value of 0 disables the account as soon
139 as the password has expired, and a value of -1 disables the
146 <option>-g</option>, <option>--gid</option>
147 <replaceable>GROUP</replaceable>
151 The group name or number of the user's new initial login group.
152 The group must exist.
158 <option>-G</option>, <option>--groups</option>
159 <replaceable>GROUP1</replaceable>[<emphasis remap='I'>,GROUP2,...</emphasis>[<emphasis remap='I'>,GROUPN</emphasis>]]]
163 A list of supplementary groups which the user is also a member
164 of. Each group is separated from the next by a comma, with no
165 intervening whitespace. The groups are subject to the same
166 restrictions as the group given with the <option>-g</option>
170 If the user is currently a member of a group which is
171 not listed, the user will be removed from the group. This
172 behaviour can be changed via the <option>-a</option> option, which
173 appends the user to the current supplementary group list.
179 <option>-l</option>, <option>--login</option>
180 <replaceable>NEW_LOGIN</replaceable>
184 The name of the user will be changed from
185 <replaceable>LOGIN</replaceable> to
186 <replaceable>NEW_LOGIN</replaceable>. Nothing else is changed. In
187 particular, the user's home directory name should probably be
188 changed manually to reflect the new login name.
194 <option>-L</option>, <option>--lock</option>
198 Lock a user's password. This puts a '!' in front of the
199 encrypted password, effectively disabling the password. You
200 can't use this option with <option>-p</option> or
204 Note: if you wish to lock the account (not only access with a
205 password), you should also set the
206 <replaceable>EXPIRE_DATE</replaceable> to
207 <replaceable>1</replaceable>.
213 <option>-m</option>, <option>--move-home</option>
217 Move the content of the user's home directory to the new
221 This option is only valid in combination with the
222 <option>-d</option> (or <option>--home</option>) option.
228 <option>-o</option>, <option>--non-unique</option>
232 When used with the <option>-u</option> option, this option
233 allows to change the user ID to a non-unique value.
239 <option>-p</option>, <option>--password</option>
240 <replaceable>PASSWORD</replaceable>
244 The encrypted password, as returned by <citerefentry>
245 <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
249 <emphasis role="bold">Note:</emphasis> This option is not
250 recommended because the password (or encrypted password) will
251 be visible by users listing the processes.
253 <para condition="pam">
254 The password will be written in the local
255 <filename>/etc/passwd</filename> or
256 <filename>/etc/shadow</filename> file. This might differ from the
257 password database configured in your PAM configuration.
260 You should make sure the password respects the system's
267 <option>-s</option>, <option>--shell</option>
268 <replaceable>SHELL</replaceable>
272 The name of the user's new login shell. Setting this field to
273 blank causes the system to select the default login shell.
279 <option>-u</option>, <option>--uid</option>
280 <replaceable>UID</replaceable>
284 The new numerical value of the user's ID.
287 This value must be unique,
288 unless the <option>-o</option> option is used. The value must be
289 non-negative. Values between 0 and 999 are typically reserved
293 The user's mailbox, and any files which the user owns and which are
294 located in the user's home
295 directory will have the file user ID changed automatically.
298 The ownership of files outside of the user's home directory
299 must be fixed manually.
305 <option>-U</option>, <option>--unlock</option>
309 Unlock a user's password. This removes the '!' in front of the
310 encrypted password. You can't use this option with
311 <option>-p</option> or <option>-L</option>.
314 Note: if you wish to unlock the account (not only access with a
315 password), you should also set the
316 <replaceable>EXPIRE_DATE</replaceable> (for example to
317 <replaceable>99999</replaceable>, or to the
318 <option>EXPIRE</option> value from
319 <filename>/etc/default/useradd</filename>).
325 <option>-Z</option>, <option>--selinux-user</option>
326 <replaceable>SEUSER</replaceable>
330 The SELinux user for the user's login. The default is to leave
331 this field the blank, which causes the system to select the
332 default SELinux user.
339 <refsect1 id='caveats'>
340 <title>CAVEATS</title>
342 You must make certain that the named user is
343 not executing any processes when this command is being executed if the
344 user's numerical user ID, the user's name, or the user's home
345 directory is being changed. <command>usermod</command> checks this
346 on Linux, but only check if the user is logged in according to utmp
347 on other architectures.
350 You must change the owner of any <command>crontab</command> files or
351 <command>at</command> jobs manually.
354 You must make any changes involving NIS on the NIS server.
358 <refsect1 id='configuration'>
359 <title>CONFIGURATION</title>
361 The following configuration variables in
362 <filename>/etc/login.defs</filename> change the behavior of this
366 &MAIL_DIR; <!-- documents also MAIL_FILE -->
367 &MAX_MEMBERS_PER_GROUP;
371 <refsect1 id='files'>
375 <term><filename>/etc/group</filename></term>
377 <para>Group account information.</para>
380 <varlistentry condition="gshadow">
381 <term><filename>/etc/gshadow</filename></term>
383 <para>Secure group account information.</para>
387 <term><filename>/etc/passwd</filename></term>
389 <para>User account information.</para>
393 <term><filename>/etc/shadow</filename></term>
395 <para>Secure user account information.</para>
401 <refsect1 id='see_also'>
402 <title>SEE ALSO</title>
405 <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
408 <refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum>
411 <refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
414 <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
417 <refentrytitle>gpasswd</refentrytitle><manvolnum>8</manvolnum>
420 <refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum>
423 <refentrytitle>groupdel</refentrytitle><manvolnum>8</manvolnum>
426 <refentrytitle>groupmod</refentrytitle><manvolnum>8</manvolnum>
429 <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
432 <refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum>
435 <refentrytitle>userdel</refentrytitle><manvolnum>8</manvolnum>