old-www/LDP/lame/LAME/linux-admin-made-easy/removing-user-accounts.html

247 lines
4.1 KiB
HTML

<HTML
><HEAD
><TITLE
>Removing User Accounts</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
"><LINK
REL="HOME"
TITLE="Linux Administration Made Easy"
HREF="index.html"><LINK
REL="UP"
TITLE="General System Administration Issues"
HREF="administrative-issues.html"><LINK
REL="PREVIOUS"
TITLE="Disabling User Accounts"
HREF="disabling-user-accounts.html"><LINK
REL="NEXT"
TITLE="Linux Password & Shadow File Formats"
HREF="shadow-file-formats.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux Administration Made Easy</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="disabling-user-accounts.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 6. General System Administration Issues</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="shadow-file-formats.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="REMOVING-USER-ACCOUNTS"
>6.5. Removing User Accounts</A
></H1
><P
>On occasion, you may wish to remove a user's access from your server
altogether.</P
><P
>If you are a Red Hat user, the easiest way to remove an unneeded
user account is with the ``<TT
CLASS="LITERAL"
>userdel</TT
>'' command, which
must be typed as ``root''. An example follows:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SCREEN"
>/usr/sbin/userdel baduser</PRE
></TD
></TR
></TABLE
><P
>The above command will remove the entry matching the username
``<EM
>baduser</EM
> from the
``<TT
CLASS="LITERAL"
><TT
CLASS="FILENAME"
>/etc/passwd</TT
></TT
>'', file, and, if
you're using the Shadow password format (which you should be; see <A
HREF="shadow-file-formats.html"
>Section 6.6</A
> for details), the
``<TT
CLASS="LITERAL"
><TT
CLASS="FILENAME"
>/etc/shadow</TT
></TT
>''.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>Note: The ``<TT
CLASS="LITERAL"
><TT
CLASS="FILENAME"
>/etc/group</TT
></TT
>'' is
<EM
>not</EM
> modified, to avoid removing a group that other
user(s) may also belong to. This isn't much of a big deal, but if this
bothers use, you can edit the group file and remove the entry
manually.</P
></BLOCKQUOTE
></DIV
><P
>Should you wish to remove the user's home directory as well, add
the ``<TT
CLASS="LITERAL"
>-r</TT
>'' option to the ``userdel'' command. For
example:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SCREEN"
>/usr/sbin/userdel -r baduser</PRE
></TD
></TR
></TABLE
><P
>I recommend not removing an account right away, but first simply
<EM
>disable</EM
> it, especially if you are working with a
corporate server with lots of users. After all, the former user may one
day require the use of his or her account again, or may request a file or
two which was stored in their home directory. Or perhaps a
<EM
>new</EM
> user (such as an employee replacement) may
require access to the former user's files. In any event, make sure you
have backups of the former user's home directory,
<SPAN
CLASS="QUOTE"
>"just-in-case"</SPAN
>. See <A
HREF="disabling-user-accounts.html"
>Section 6.4</A
>
for details on disabling an account, and <A
HREF="backup-and-restore.html"
>Chapter 8</A
> for details on how to perform
backups.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="disabling-user-accounts.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="shadow-file-formats.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Disabling User Accounts</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="administrative-issues.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Linux Password &#38; Shadow File Formats</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>