]> granicus.if.org Git - shadow/blob - man/usermod.8.xml
* man/usermod.8.xml: Document behavior of an empty EXPIRE_DATE.
[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 <!-- SHADOW-CONFIG-HERE -->
38 ]>
39 <refentry id='usermod.8'>
40   <!--  $Id$  -->
41   <refmeta>
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>
47   </refmeta>
48   <refnamediv id='name'>
49     <refname>usermod</refname>
50     <refpurpose>modify a user account</refpurpose>
51   </refnamediv>
52
53   <refsynopsisdiv id='synopsis'>
54     <cmdsynopsis>
55       <command>usermod</command>
56       <arg choice='opt'>
57         <replaceable>options</replaceable>
58       </arg>
59       <arg choice='plain'><replaceable>LOGIN</replaceable></arg>
60     </cmdsynopsis>
61   </refsynopsisdiv>
62
63   <refsect1 id='description'>
64     <title>DESCRIPTION</title>
65     <para>
66       The <command>usermod</command> command modifies the system account
67       files to reflect the changes that are specified on the command line.
68     </para>
69   </refsect1>
70
71   <refsect1 id='options'>
72     <title>OPTIONS</title>
73     <para>
74       The options which apply to the <command>usermod</command> command
75       are:
76     </para>
77     <variablelist>
78       <varlistentry>
79         <term>
80           <option>-a</option>, <option>--append</option>
81         </term>
82         <listitem>
83           <para>
84             Add the user to the supplementary group(s). Use only with the
85             <option>-G</option> option.
86           </para>
87         </listitem>
88       </varlistentry>
89       <varlistentry>
90         <term>
91           <option>-c</option>, <option>--comment</option>
92           <replaceable>COMMENT</replaceable>
93         </term>
94         <listitem>
95           <para>
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.
100           </para>
101         </listitem>
102       </varlistentry>
103       <varlistentry>
104         <term>
105           <option>-d</option>, <option>--home</option>
106           <replaceable>HOME_DIR</replaceable>
107         </term>
108         <listitem>
109           <para>
110             The user's new login directory.
111           </para>
112           <para>
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
116             not already exist.
117           </para>
118         </listitem>
119       </varlistentry>
120       <varlistentry>
121         <term>
122           <option>-e</option>, <option>--expiredate</option>
123           <replaceable>EXPIRE_DATE</replaceable>
124         </term>
125         <listitem>
126           <para>
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>.
129           </para>
130           <para>
131             An empty <replaceable>EXPIRE_DATE</replaceable> argument will
132             disable the expiration of the account.
133           </para>
134           <para>
135             This option requires a <filename>/etc/shadow</filename> file.
136             A <filename>/etc/shadow</filename> entry will be created if
137             there were none.
138           </para>
139         </listitem>
140       </varlistentry>
141       <varlistentry>
142         <term>
143           <option>-f</option>, <option>--inactive</option>
144           <replaceable>INACTIVE</replaceable>
145         </term>
146         <listitem>
147           <para>
148             The number of days after a password expires until the account is
149             permanently disabled.
150           </para>
151           <para>
152             A value of 0 disables the account as soon
153             as the password has expired, and a value of -1 disables the
154             feature.
155           </para>
156           <para>
157             This option requires a <filename>/etc/shadow</filename> file.
158             A <filename>/etc/shadow</filename> entry will be created if
159             there were none.
160           </para>
161         </listitem>
162       </varlistentry>
163       <varlistentry>
164         <term>
165           <option>-g</option>, <option>--gid</option>
166           <replaceable>GROUP</replaceable>
167         </term>
168         <listitem>
169           <para>
170             The group name or number of the user's new initial login group.
171             The group must exist.
172           </para>
173           <para>
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.
176           </para>
177           <para>
178             The group ownership of files outside of the user's home directory
179             must be fixed manually.
180           </para>
181         </listitem>
182       </varlistentry>
183       <varlistentry>
184         <term>
185           <option>-G</option>, <option>--groups</option>
186           <replaceable>GROUP1</replaceable>[<emphasis remap='I'>,GROUP2,...</emphasis>[<emphasis remap='I'>,GROUPN</emphasis>]]]
187         </term>
188         <listitem>
189           <para>
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>
194             option.
195           </para>
196           <para>
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.
201           </para>
202         </listitem>
203       </varlistentry>
204       <varlistentry>
205         <term>
206           <option>-l</option>, <option>--login</option>
207           <replaceable>NEW_LOGIN</replaceable>
208         </term>
209         <listitem>
210           <para>
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.
216           </para>
217         </listitem>
218       </varlistentry>
219       <varlistentry>
220         <term>
221           <option>-L</option>, <option>--lock</option>
222         </term>
223         <listitem>
224           <para>
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
228             <option>-U</option>.
229           </para>
230           <para>
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>.
235           </para>
236         </listitem>
237       </varlistentry>
238       <varlistentry>
239         <term>
240           <option>-m</option>, <option>--move-home</option>
241         </term>
242         <listitem>
243           <para>
244             Move the content of the user's home directory to the new
245             location.
246           </para>
247           <para>
248             This option is only valid in combination with the
249             <option>-d</option> (or <option>--home</option>) option.
250           </para>
251           <para>
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.
255           </para>
256         </listitem>
257       </varlistentry>
258       <varlistentry>
259         <term>
260           <option>-o</option>, <option>--non-unique</option>
261         </term>
262         <listitem>
263           <para>
264             When used with the <option>-u</option> option, this option
265             allows to change the user ID to a non-unique value.
266           </para>
267         </listitem>
268       </varlistentry>
269       <varlistentry>
270         <term>
271           <option>-p</option>, <option>--password</option>
272           <replaceable>PASSWORD</replaceable>
273         </term>
274         <listitem>
275           <para>
276             The encrypted password, as returned by <citerefentry>
277             <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
278             </citerefentry>.
279           </para>
280           <para>
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.
284           </para>
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.
290           </para>
291           <para>
292             You should make sure the password respects the system's
293             password policy.
294           </para>
295         </listitem>
296       </varlistentry>
297       <varlistentry>
298         <term>
299           <option>-s</option>, <option>--shell</option>
300           <replaceable>SHELL</replaceable>
301         </term>
302         <listitem>
303           <para>
304             The name of the user's new login shell. Setting this field to
305             blank causes the system to select the default login shell.
306           </para>
307         </listitem>
308       </varlistentry>
309       <varlistentry>
310         <term>
311           <option>-u</option>, <option>--uid</option>
312           <replaceable>UID</replaceable>
313         </term>
314         <listitem>
315           <para>
316             The new numerical value of the user's ID.
317           </para>
318           <para>
319             This value must be unique,
320             unless the <option>-o</option> option is used. The value must be
321             non-negative. Values between 0 and 999 are typically reserved
322             for system accounts.
323           </para>
324           <para>
325             The user's mailbox, and any files which the user owns and which are
326             located in the user's home
327             directory will have the file user ID changed automatically.
328           </para>
329           <para>
330             The ownership of files outside of the user's home directory
331             must be fixed manually.
332           </para>
333         </listitem>
334       </varlistentry>
335       <varlistentry>
336         <term>
337           <option>-U</option>, <option>--unlock</option>
338         </term>
339         <listitem>
340           <para>
341             Unlock a user's password. This removes the '!' in front of the
342             encrypted password. You can't use this option with
343             <option>-p</option> or <option>-L</option>.
344           </para>
345           <para>
346             Note: if you wish to unlock the account (not only access with a
347             password), you should also set the
348             <replaceable>EXPIRE_DATE</replaceable> (for example to
349             <replaceable>99999</replaceable>, or to the
350             <option>EXPIRE</option> value from
351             <filename>/etc/default/useradd</filename>).
352           </para>
353         </listitem>
354       </varlistentry>
355         <varlistentry>
356           <term>
357             <option>-Z</option>, <option>--selinux-user</option>
358             <replaceable>SEUSER</replaceable>
359           </term>
360           <listitem>
361             <para>
362               The SELinux user for the user's login. The default is to leave
363               this field the blank, which causes the system to select the
364               default SELinux user.
365             </para>
366           </listitem>
367         </varlistentry>
368     </variablelist>
369   </refsect1>
370
371   <refsect1 id='caveats'>
372     <title>CAVEATS</title>
373     <para>
374       You must make certain that the named user is
375       not executing any processes when this command is being executed if the
376       user's numerical user ID, the user's name, or the user's home
377       directory is being changed. <command>usermod</command> checks this
378       on Linux, but only check if the user is logged in according to utmp
379       on other architectures.
380     </para>
381     <para>
382       You must change the owner of any <command>crontab</command> files or
383       <command>at</command> jobs manually.
384     </para>
385     <para>
386       You must make any changes involving NIS on the NIS server.
387     </para>
388   </refsect1>
389
390   <refsect1 id='configuration'>
391     <title>CONFIGURATION</title>
392     <para>
393       The following configuration variables in
394       <filename>/etc/login.defs</filename> change the behavior of this
395       tool:
396     </para>
397     <variablelist>
398       &MAIL_DIR; <!-- documents also MAIL_FILE -->
399       &MAX_MEMBERS_PER_GROUP;
400       &TCB_SYMLINKS;
401       &USE_TCB;
402     </variablelist>
403   </refsect1>
404
405   <refsect1 id='files'>
406     <title>FILES</title>
407     <variablelist>
408       <varlistentry>
409         <term><filename>/etc/group</filename></term>
410         <listitem>
411           <para>Group account information.</para>
412         </listitem>
413       </varlistentry>
414       <varlistentry condition="gshadow">
415         <term><filename>/etc/gshadow</filename></term>
416         <listitem>
417           <para>Secure group account information.</para>
418         </listitem>
419       </varlistentry>
420       <varlistentry>
421         <term><filename>/etc/passwd</filename></term>
422         <listitem>
423           <para>User account information.</para>
424         </listitem>
425       </varlistentry>
426       <varlistentry>
427         <term><filename>/etc/shadow</filename></term>
428         <listitem>
429           <para>Secure user account information.</para>
430         </listitem>
431       </varlistentry>
432     </variablelist>
433   </refsect1>
434
435   <refsect1 id='see_also'>
436     <title>SEE ALSO</title>
437     <para>
438       <citerefentry>
439         <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
440       </citerefentry>,
441       <citerefentry>
442         <refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum>
443       </citerefentry>,
444       <citerefentry>
445         <refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
446       </citerefentry>,
447       <citerefentry>
448         <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
449       </citerefentry>,
450       <citerefentry>
451         <refentrytitle>gpasswd</refentrytitle><manvolnum>8</manvolnum>
452       </citerefentry>,
453       <citerefentry>
454         <refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum>
455       </citerefentry>,
456       <citerefentry>
457         <refentrytitle>groupdel</refentrytitle><manvolnum>8</manvolnum>
458       </citerefentry>,
459       <citerefentry>
460         <refentrytitle>groupmod</refentrytitle><manvolnum>8</manvolnum>
461       </citerefentry>,
462       <citerefentry>
463         <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
464       </citerefentry>,
465       <citerefentry>
466         <refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum>
467       </citerefentry>,
468       <citerefentry>
469         <refentrytitle>userdel</refentrytitle><manvolnum>8</manvolnum>
470       </citerefentry>.
471     </para>
472   </refsect1>
473 </refentry>