]> granicus.if.org Git - shadow/blob - man/usermod.8.xml
* libmisc/find_new_uid.c, libmisc/find_new_gid.c: Add missing
[shadow] / man / usermod.8.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3    Copyright (c) 1991 - 1994, Julianne Frances Haugh
4    Copyright (c) 2007 - 2009, Nicolas François
5    All rights reserved.
6   
7    Redistribution and use in source and binary forms, with or without
8    modification, are permitted provided that the following conditions
9    are met:
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.
18   
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.
30 -->
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 ]>
38 <refentry id='usermod.8'>
39   <!--  $Id$  -->
40   <refmeta>
41     <refentrytitle>usermod</refentrytitle>
42     <manvolnum>8</manvolnum>
43     <refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
44   </refmeta>
45   <refnamediv id='name'>
46     <refname>usermod</refname>
47     <refpurpose>modify a user account</refpurpose>
48   </refnamediv>
49
50   <refsynopsisdiv id='synopsis'>
51     <cmdsynopsis>
52       <command>usermod</command>
53       <arg choice='opt'>
54         <replaceable>options</replaceable>
55       </arg>
56       <arg choice='plain'><replaceable>LOGIN</replaceable></arg>
57     </cmdsynopsis>
58   </refsynopsisdiv>
59
60   <refsect1 id='description'>
61     <title>DESCRIPTION</title>
62     <para>
63       The <command>usermod</command> command modifies the system account
64       files to reflect the changes that are specified on the command line.
65     </para>
66   </refsect1>
67
68   <refsect1 id='options'>
69     <title>OPTIONS</title>
70     <para>
71       The options which apply to the <command>usermod</command> command
72       are:
73     </para>
74     <variablelist>
75       <varlistentry>
76         <term>
77           <option>-a</option>, <option>--append</option>
78         </term>
79         <listitem>
80           <para>
81             Add the user to the supplementary group(s). Use only with the
82             <option>-G</option> option.
83           </para>
84         </listitem>
85       </varlistentry>
86       <varlistentry>
87         <term>
88           <option>-c</option>, <option>--comment</option>
89           <replaceable>COMMENT</replaceable>
90         </term>
91         <listitem>
92           <para>
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.
97           </para>
98         </listitem>
99       </varlistentry>
100       <varlistentry>
101         <term>
102           <option>-d</option>, <option>--home</option>
103           <replaceable>HOME_DIR</replaceable>
104         </term>
105         <listitem>
106           <para>
107             The user's new login directory.
108           </para>
109           <para>
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
113             not already exist.
114           </para>
115         </listitem>
116       </varlistentry>
117       <varlistentry>
118         <term>
119           <option>-e</option>, <option>--expiredate</option>
120           <replaceable>EXPIRE_DATE</replaceable>
121         </term>
122         <listitem>
123           <para>
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>.
126           </para>
127         </listitem>
128       </varlistentry>
129       <varlistentry>
130         <term>
131           <option>-f</option>, <option>--inactive</option>
132           <replaceable>INACTIVE</replaceable>
133         </term>
134         <listitem>
135           <para>
136             The number of days after a password expires until the account is
137             permanently disabled.
138           </para>
139           <para>
140             A value of 0 disables the account as soon
141             as the password has expired, and a value of -1 disables the
142             feature.
143           </para>
144         </listitem>
145       </varlistentry>
146       <varlistentry>
147         <term>
148           <option>-g</option>, <option>--gid</option>
149           <replaceable>GROUP</replaceable>
150         </term>
151         <listitem>
152           <para>
153             The group name or number of the user's new initial login group.
154             The group must exist.
155           </para>
156           <para>
157             Any file from the user's home directory owned by the previous
158             primary group of the user will be owned by this new group.
159           </para>
160           <para>
161             The group ownership of files outside of the user's home directory
162             must be fixed manually.
163           </para>
164         </listitem>
165       </varlistentry>
166       <varlistentry>
167         <term>
168           <option>-G</option>, <option>--groups</option>
169           <replaceable>GROUP1</replaceable>[<emphasis remap='I'>,GROUP2,...</emphasis>[<emphasis remap='I'>,GROUPN</emphasis>]]]
170         </term>
171         <listitem>
172           <para>
173             A list of supplementary groups which the user is also a member
174             of. Each group is separated from the next by a comma, with no
175             intervening whitespace. The groups are subject to the same
176             restrictions as the group given with the <option>-g</option>
177             option.
178           </para>
179           <para>
180             If the user is currently a member of a group which is
181             not listed, the user will be removed from the group. This
182             behaviour can be changed via the <option>-a</option> option, which
183             appends the user to the current supplementary group list.
184           </para>
185         </listitem>
186       </varlistentry>
187       <varlistentry>
188         <term>
189           <option>-l</option>, <option>--login</option>
190           <replaceable>NEW_LOGIN</replaceable>
191         </term>
192         <listitem>
193           <para>
194             The name of the user will be changed from
195             <replaceable>LOGIN</replaceable> to
196             <replaceable>NEW_LOGIN</replaceable>. Nothing else is changed. In
197             particular, the user's home directory name should probably be
198             changed manually to reflect the new login name.
199           </para>
200         </listitem>
201       </varlistentry>
202       <varlistentry>
203         <term>
204           <option>-L</option>, <option>--lock</option>
205         </term>
206         <listitem>
207           <para>
208             Lock a user's password. This puts a '!' in front of the
209             encrypted password, effectively disabling the password. You
210             can't use this option with <option>-p</option> or
211             <option>-U</option>.
212           </para>
213           <para>
214             Note: if you wish to lock the account (not only access with a
215             password), you should also set the
216             <replaceable>EXPIRE_DATE</replaceable> to
217             <replaceable>1</replaceable>.
218           </para>
219         </listitem>
220       </varlistentry>
221       <varlistentry>
222         <term>
223           <option>-m</option>, <option>--move-home</option>
224         </term>
225         <listitem>
226           <para>
227             Move the content of the user's home directory to the new
228             location.
229           </para>
230           <para>
231             This option is only valid in combination with the
232             <option>-d</option> (or <option>--home</option>) option.
233           </para>
234           <para>
235             <command>usermod</command> will try to adapt the ownership of the
236             files and to copy the modes, ACL and extended attributes, but
237             manual changes might be needed afterwards.
238           </para>
239         </listitem>
240       </varlistentry>
241       <varlistentry>
242         <term>
243           <option>-o</option>, <option>--non-unique</option>
244         </term>
245         <listitem>
246           <para>
247             When used with the <option>-u</option> option, this option
248             allows to change the user ID to a non-unique value.
249           </para>
250         </listitem>
251       </varlistentry>
252       <varlistentry>
253         <term>
254           <option>-p</option>, <option>--password</option>
255           <replaceable>PASSWORD</replaceable>
256         </term>
257         <listitem>
258           <para>
259             The encrypted password, as returned by <citerefentry>
260             <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
261             </citerefentry>.
262           </para>
263           <para>
264             <emphasis role="bold">Note:</emphasis> This option is not
265             recommended because the password (or encrypted password) will
266             be visible by users listing the processes.
267           </para>
268           <para condition="pam">
269             The password will be written in the local
270             <filename>/etc/passwd</filename> or
271             <filename>/etc/shadow</filename> file. This might differ from the
272             password database configured in your PAM configuration.
273           </para>
274           <para>
275             You should make sure the password respects the system's
276             password policy.
277           </para>
278         </listitem>
279       </varlistentry>
280       <varlistentry>
281         <term>
282           <option>-s</option>, <option>--shell</option>
283           <replaceable>SHELL</replaceable>
284         </term>
285         <listitem>
286           <para>
287             The name of the user's new login shell. Setting this field to
288             blank causes the system to select the default login shell.
289           </para>
290         </listitem>
291       </varlistentry>
292       <varlistentry>
293         <term>
294           <option>-u</option>, <option>--uid</option>
295           <replaceable>UID</replaceable>
296         </term>
297         <listitem>
298           <para>
299             The new numerical value of the user's ID.
300           </para>
301           <para>
302             This value must be unique,
303             unless the <option>-o</option> option is used. The value must be
304             non-negative. Values between 0 and 999 are typically reserved
305             for system accounts.
306           </para>
307           <para>
308             The user's mailbox, and any files which the user owns and which are
309             located in the user's home
310             directory will have the file user ID changed automatically.
311           </para>
312           <para>
313             The ownership of files outside of the user's home directory
314             must be fixed manually.
315           </para>
316         </listitem>
317       </varlistentry>
318       <varlistentry>
319         <term>
320           <option>-U</option>, <option>--unlock</option>
321         </term>
322         <listitem>
323           <para>
324             Unlock a user's password. This removes the '!' in front of the
325             encrypted password. You can't use this option with
326             <option>-p</option> or <option>-L</option>.
327           </para>
328           <para>
329             Note: if you wish to unlock the account (not only access with a
330             password), you should also set the
331             <replaceable>EXPIRE_DATE</replaceable> (for example to
332             <replaceable>99999</replaceable>, or to the
333             <option>EXPIRE</option> value from
334             <filename>/etc/default/useradd</filename>).
335           </para>
336         </listitem>
337       </varlistentry>
338         <varlistentry>
339           <term>
340             <option>-Z</option>, <option>--selinux-user</option>
341             <replaceable>SEUSER</replaceable>
342           </term>
343           <listitem>
344             <para>
345               The SELinux user for the user's login. The default is to leave
346               this field the blank, which causes the system to select the
347               default SELinux user.
348             </para>
349           </listitem>
350         </varlistentry>
351     </variablelist>
352   </refsect1>
353
354   <refsect1 id='caveats'>
355     <title>CAVEATS</title>
356     <para>
357       You must make certain that the named user is
358       not executing any processes when this command is being executed if the
359       user's numerical user ID, the user's name, or the user's home
360       directory is being changed. <command>usermod</command> checks this
361       on Linux, but only check if the user is logged in according to utmp
362       on other architectures.
363     </para>
364     <para>
365       You must change the owner of any <command>crontab</command> files or
366       <command>at</command> jobs manually.
367     </para>
368     <para>
369       You must make any changes involving NIS on the NIS server.
370     </para>
371   </refsect1>
372
373   <refsect1 id='configuration'>
374     <title>CONFIGURATION</title>
375     <para>
376       The following configuration variables in
377       <filename>/etc/login.defs</filename> change the behavior of this
378       tool:
379     </para>
380     <variablelist>
381       &MAIL_DIR; <!-- documents also MAIL_FILE -->
382       &MAX_MEMBERS_PER_GROUP;
383       &TCB_SYMLINKS;
384       &USE_TCB;
385     </variablelist>
386   </refsect1>
387
388   <refsect1 id='files'>
389     <title>FILES</title>
390     <variablelist>
391       <varlistentry>
392         <term><filename>/etc/group</filename></term>
393         <listitem>
394           <para>Group account information.</para>
395         </listitem>
396       </varlistentry>
397       <varlistentry condition="gshadow">
398         <term><filename>/etc/gshadow</filename></term>
399         <listitem>
400           <para>Secure group account information.</para>
401         </listitem>
402       </varlistentry>
403       <varlistentry>
404         <term><filename>/etc/passwd</filename></term>
405         <listitem>
406           <para>User account information.</para>
407         </listitem>
408       </varlistentry>
409       <varlistentry>
410         <term><filename>/etc/shadow</filename></term>
411         <listitem>
412           <para>Secure user account information.</para>
413         </listitem>
414       </varlistentry>
415     </variablelist>
416   </refsect1>
417
418   <refsect1 id='see_also'>
419     <title>SEE ALSO</title>
420     <para>
421       <citerefentry>
422         <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
423       </citerefentry>,
424       <citerefentry>
425         <refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum>
426       </citerefentry>,
427       <citerefentry>
428         <refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
429       </citerefentry>,
430       <citerefentry>
431         <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
432       </citerefentry>,
433       <citerefentry>
434         <refentrytitle>gpasswd</refentrytitle><manvolnum>8</manvolnum>
435       </citerefentry>,
436       <citerefentry>
437         <refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum>
438       </citerefentry>,
439       <citerefentry>
440         <refentrytitle>groupdel</refentrytitle><manvolnum>8</manvolnum>
441       </citerefentry>,
442       <citerefentry>
443         <refentrytitle>groupmod</refentrytitle><manvolnum>8</manvolnum>
444       </citerefentry>,
445       <citerefentry>
446         <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
447       </citerefentry>,
448       <citerefentry>
449         <refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum>
450       </citerefentry>,
451       <citerefentry>
452         <refentrytitle>userdel</refentrytitle><manvolnum>8</manvolnum>
453       </citerefentry>.
454     </para>
455   </refsect1>
456 </refentry>