Home
Certification Preparation
CompTIA
Linux+
userdel without -r option
Haruna Umar Adoga
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
Find more posts tagged with
Comments
DoubleNNs
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.
Xavor
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.
Haruna Umar Adoga
Thanks guys for helping out, will try the rm -r command to delete the user home directory recursively as advised..
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of