'userdel' irony -- what do you say ?

Tom H tomh0665 at gmail.com
Mon May 31 06:25:44 UTC 2010


On Mon, May 31, 2010 at 12:12 AM, sawrub <sawrub at fedoraproject.org> wrote:
>
> I created a user by the name test, and after doing with my testing was going
> to delete the user using the following command, userdel and also added '-f'
> for cleaning out the home without leaving any traces of 'test'. But the
> command says :
>
> [root at xbox ~]# userdel -f test
> userdel: user test is currently logged in
>
> Then i noticed that a tab in terminal was open with the user logged in.
> Closed the TAB and again tried to remove the user. And to irony the user was
> already gone as now the command said :.
>
> [root at xbox ~]# userdel -f test
> userdel: user 'test' does not exist
>
> Tried listing the files and all were there intact.
>
> [root at xbox ~]# ll /home/test/
> .bash_history          .bash_profile          .dbus/
> firefox-3.6.4.tar.bz2  .gconfd/               .gnome2_private/
> .pulse-cookie
> .bash_logout           .bashrc                firefox/
> .gconf/                .gnome2/               .mozilla/
> [root at xbox ~]#
>
> I'm totally lost that how is parameter working fully against what man says
> about it, pert manual
>
> -f, --force
>            This option forces the removal of the user account, even if the
> user is still logged in. It also forces userdel to remove the user´s home
> directory and mail spool, even if another user uses the same home directory
> or if the mail spool is not owned by the specified user. If USERGROUPS_ENAB
> is defined to yes in /etc/login.defs and if a group exists with the same
> name as the deleted user, then this group will be removed, even if it is
> still the primary group of another user.
>
> Seems that there is some issue with the command parameter, what do you say ?
> is there some issue or Am i wrong somewhere.

You didn't quote the last part of that section of the manpage: "Note:
This option is dangerous and may leave your system in an inconsistent
state."

If you want to remove a user's files and directories, make sure he/she
is logged off and run "userdel -r...".


More information about the users mailing list