+ Reply to Thread
Results 1 to 4 of 4
  1. Junior Member Haruna Umar Adoga's Avatar
    Join Date
    Jul 2009
    Location
    Hatfield, United Kingdom
    Posts
    22

    Certifications
    ITILv3, CCNA, CCNP, Beng Elect Elect Engineering
    #1

    Default userdel without -r option

    Hello everyone, I am a newbie with the linux OS and have been playing around with adding and removing users, after adding a new user, I tried deleting the user using the userdel command without the -r option, using the ls command still shows the user on my PC and if i try to delete the user again, it says such user does not exist even when i use the -r option. What should I do to get rid of the user ? any help will be appreciated
    Reply With Quote Quote  

  2. SS -->
  3. Senior Member DoubleNNs's Avatar
    Join Date
    Oct 2012
    Location
    Charlotte, NC
    Posts
    1,942

    Certifications
    A+, VCA-DCV, Linux+/LPIC-1, AWS CSA, AWS Dev, AWS SysOps, Project+ [Expired: Net+, Sec+, CCENT, CCNA]
    #2
    It shows the user's files when you use the ls cmd, not the user itself.

    You deleted the user but kept the files in their home directory intact. If you rm - r their home directory, you'll finish completely removing the user and their files.

    That's what happens when you use the userdel cmd. Try doing a man userdel to see what the different flags accomplish.

    userdel -f - also deletes files other users might've placed in the deleted user's home directory, even if root put it there. (safer to use userdel -r)
    userdel -r - removes the user and their home directory recursively.
    userdel - w/o any flags deletes the user but doesn't delete their home folder.
    Last edited by DoubleNNs; 09-20-2014 at 05:15 PM.
    Goals for 2017:
    RHCSA, RHCE, LFCS: Ubuntu | Project+ | AWS Certified DevOps Engineer | Learn Docker, Kubernetes, Prometheus, Golang | Improve Python Programming
    Reply With Quote Quote  

  4. Senior Member Xavor's Avatar
    Join Date
    Apr 2013
    Location
    Greater DC area, USA
    Posts
    160

    Certifications
    VCP5, RHCSA, Sec+, ITIL
    #3
    You can create the user again. You will see some errors where it tries to create the mail directory, but it already exists. Then you can remove the user with the -r flag and it should clean them out.

    Or, you can do a find on / for the user and manually delete directories.
    Reply With Quote Quote  

  5. Junior Member Haruna Umar Adoga's Avatar
    Join Date
    Jul 2009
    Location
    Hatfield, United Kingdom
    Posts
    22

    Certifications
    ITILv3, CCNA, CCNP, Beng Elect Elect Engineering
    #4
    Thanks guys for helping out, will try the rm -r command to delete the user home directory recursively as advised..
    Reply With Quote Quote  

+ Reply to Thread

Social Networking & Bookmarks