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 USERDEL_CMD SYSTEM "login.defs.d/USERDEL_CMD.xml">
36 <!ENTITY USERGROUPS_ENAB SYSTEM "login.defs.d/USERGROUPS_ENAB.xml">
38 <refentry id='userdel.8'>
39 <!-- $Id: userdel.8.xml 2964 2009-05-21 12:02:12Z nekral-guest $ -->
41 <refentrytitle>userdel</refentrytitle>
42 <manvolnum>8</manvolnum>
43 <refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
45 <refnamediv id='name'>
46 <refname>userdel</refname>
47 <refpurpose>delete a user account and related files</refpurpose>
49 <refsynopsisdiv id='synopsis'>
51 <command>userdel</command>
52 <arg choice='opt'>options</arg>
54 <replaceable>LOGIN</replaceable>
59 <refsect1 id='description'>
60 <title>DESCRIPTION</title>
62 The <command>userdel</command> command modifies the system account
63 files, deleting all entries that refer to the user name <emphasis
64 remap='I'>LOGIN</emphasis>. The named user must exist.
68 <refsect1 id='options'>
69 <title>OPTIONS</title>
71 The options which apply to the <command>userdel</command> command are:
73 <variablelist remap='IP'>
76 <option>-f</option>, <option>--force</option>
80 This option forces the removal of the user account, even if the
82 logged in. It also forces <command>userdel</command> to remove
83 the user's home directory and mail spool, even if another
84 user uses the same home directory or if the mail spool is not
85 owned by the specified user. If
86 <option>USERGROUPS_ENAB</option> is defined to <emphasis
87 remap='I'>yes</emphasis> in <filename>/etc/login.defs</filename>
88 and if a group exists with the same name as the deleted user,
89 then this group will be removed, even if it is still the primary
90 group of another user.
93 <emphasis>Note:</emphasis> This option is dangerous and may leave
94 your system in an inconsistent state.
99 <term><option>-h</option>, <option>--help</option></term>
101 <para>Display help message and exit.</para>
106 <option>-r</option>, <option>--remove</option>
110 Files in the user's home directory will be removed along with
111 the home directory itself and the user's mail spool. Files
112 located in other file systems will have to be searched for and
116 The mail spool is defined by the <option>MAIL_DIR</option>
117 variable in the <filename>login.defs</filename> file.
124 <refsect1 id='configuration'>
125 <title>CONFIGURATION</title>
127 The following configuration variables in
128 <filename>/etc/login.defs</filename> change the behavior of this
132 &MAIL_DIR; <!-- documents also MAIL_FILE -->
133 &MAX_MEMBERS_PER_GROUP;
139 <refsect1 id='files'>
143 <term><filename>/etc/group</filename></term>
145 <para>Group account information.</para>
149 <term><filename>/etc/login.defs</filename></term>
151 <para>Shadow password suite configuration.</para>
155 <term><filename>/etc/passwd</filename></term>
157 <para>User account information.</para>
161 <term><filename>/etc/shadow</filename></term>
163 <para>Secure user account information.</para>
169 <refsect1 id='exit_values'>
170 <title>EXIT VALUES</title>
172 The <command>userdel</command> command exits with the following values:
175 <term><replaceable>0</replaceable></term>
181 <term><replaceable>1</replaceable></term>
183 <para>can't update password file</para>
187 <term><replaceable>2</replaceable></term>
189 <para>invalid command syntax</para>
193 <term><replaceable>6</replaceable></term>
195 <para>specified user doesn't exist</para>
199 <term><replaceable>8</replaceable></term>
201 <para>user currently logged in</para>
205 <term><replaceable>10</replaceable></term>
207 <para>can't update group file</para>
211 <term><replaceable>12</replaceable></term>
213 <para>can't remove home directory</para>
220 <refsect1 id='caveats'>
221 <title>CAVEATS</title>
223 <command>userdel</command> will not allow you to remove an account if
224 there are running processes which belong to this account. In that
225 case, you may have to kill those processes or lock the user's
226 password or account and remove the account later. The
227 <option>-f</option> option can force the deletion of this account.
230 You should manually check all file systems to ensure that no files
231 remain owned by this user.
233 <para>You may not remove any NIS attributes on a NIS client. This must
234 be performed on the NIS server.
236 <para>If <option>USERGROUPS_ENAB</option> is defined to <emphasis
237 remap='I'>yes</emphasis> in <filename>/etc/login.defs</filename>,
238 <command>userdel</command> will delete the group with the same name
239 as the user. To avoid inconsistencies in the passwd and group
240 databases, <command>userdel</command> will check that this group is
241 not used as a primary group for another user, and will just warn
242 without deleting the group otherwise. The <option>-f</option> option
243 can force the deletion of this group.
247 <refsect1 id='see_also'>
248 <title>SEE ALSO</title>
250 <refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
253 <refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum>
256 <refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
259 <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
262 <refentrytitle>gpasswd</refentrytitle><manvolnum>8</manvolnum>
265 <refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum>
268 <refentrytitle>groupdel</refentrytitle><manvolnum>8</manvolnum>
271 <refentrytitle>groupmod</refentrytitle><manvolnum>8</manvolnum>
274 <refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum>
277 <refentrytitle>usermod</refentrytitle><manvolnum>8</manvolnum>