Removing a User|
Removing a user is as simple as adding it; to do so you can either use
the userdel command, or do it by hand.
userdel can't remove an account if the user is currently logged in;
so you must kill any running processes which belong to the user you are
Also, you have to run userdel -r (notice the -r flag) if you want
to get rid of the home dir and mail spool of the user as well.
Removing a user manually requires editing a few files and removing some things,
but it's really quite simple. These steps a necessary to remove a user
from the system:
- Remove the line in /etc/passwd. As root open the file
/etc/passwd and find the line corresponding to the account you
are removing and delete it.
- Remove the user name from /etc/group. You need to remove
the username from any groups in the /etc/group file.
- Remove the line in /etc/shadow. Same process as in step
- Delete the home directory. As root do an rm -rf
on the home directory for the account.
- Delete the mail spool file. As root you need to delete