Bug 598306 - userdel enhancememt
Summary: userdel enhancememt
Alias: None
Product: Fedora
Classification: Fedora
Component: shadow-utils   
(Show other bugs)
Version: 12
Hardware: x86_64 Linux
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-06-01 03:34 UTC by sawrub
Modified: 2010-12-03 14:08 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-12-03 14:08:29 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description sawrub 2010-06-01 03:34:08 UTC
Description of problem:
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@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@xbox ~]# userdel -f test
userdel: user 'test' does not exist

Tried listing the files and all were there intact.

[root@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@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.

There seems to be some issue with the execution of -f parameter.
So all that i see here is a little change in the code to not delete the user from passwd and shadow if the user is logged in and the userdel is passed with '-f' as a paramerter, but instead alert out a proper message that the user and his home directory can't be deleted as the user is logged in. 

Version-Release number of selected component (if applicable):

How reproducible:
Easily and everytime

Steps to Reproduce:
1. Create a new user.
2. Open a session of that user in a terminal tab.
3. Try removing the same using the userdel command with '-f' parameter, keeping the session opened.
'userdel -f <username>'
4. Command execution says about the user logged in
'userdel: user <username> is currently logged in'
5. Close the session, again try the same 'userdel -f <username>'
Command says the user does not exist.

Actual results:
The user is deleted in step 4. 

Expected results:
step 4
In the backend it should not delete the user and neither his home directories.
and should alert  :
'userdel: user <username> is currently logged in, hence not deleting the user'

Comment 1 sawrub 2010-06-01 03:35:21 UTC
Version-Release number of selected component (if applicable):

Comment 2 Bug Zapper 2010-11-03 13:46:06 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 

Comment 3 Bug Zapper 2010-12-03 14:08:29 UTC
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.