[Fedora] 'userdel' irony -- what do you say ?

Sawrub luckysharma11 at gmail.com
Tue Jun 1 03:01:40 UTC 2010


On 06/01/2010 12:12 AM, Alan Evans wrote:
> On Mon, May 31, 2010 at 3:41 AM, Mihamina Rakotomandimby wrote:
>
>    
>> 1rst pass: The user has been deleted. No bug.
>> 2nd pass : There is no more user to delete. What to expect?
>>      
> But the operation wasn't atomic, since userdel was asked to delete the
> home directory on the 1st pass. It reported that it couldn't complete
> the operation because the user was logged in. However it carried on
> deleting the user and not deleting the home directory.
>
>    
>> Argument: user's HOME is not always under /home/. If there
>> is /home/test and /tmp/test and /var/lib/test, which one to delete
>> after the first pass?
>>      
> The user's home directory is wherever /etc/passwd says it is. If the
> user hadn't been deleted in the 1st pass then removing the home
> directory in the 2nd pass wouldn't have been a problem. Userdel should
> determine before it does anything whether it expects to complete the
> requested operation totally. If not then it shouldn't do anything.
>
> Failing that, it should at least provide a message during the first
> pass that suggests that it did delete the user but couldn't delete the
> home directory. That's not really what the first pass error suggested.
>
> -Alan
>    
Thanks to all who responded...the whole motive of pointing out the scene 
is that if the user home directory as pointed out under /etc/passwd was 
not deleted the same error message should have been suggested at the 
time of 1st pass along with the message that "userdel: user test is 
currently logged in".

Also as Tom said that the last part should have been read then i would 
suggest that that inconsistency could be removed if the code be improved.
Even if the user is logged in, executing the 1st pass the message should 
read like the user is logged in so not executing any operation.
Once the user logs out the proper execution of '-f' should have been 
carried out in the next pass.

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.

Hope it explain the situation.

-- 
Saurabh Sharma
Linux user number: 490644
http://sawrub-blog.blogspot.com/
Open your doors.......It's time to look beyond Windows



More information about the users mailing list