Thursday, January 29, 2015

How to delete user account in Linux?



Deleting user account in Linux is as a task to remove user login credentials from system configuration files such as /etc/passwd, /etc/shadow and files which are owned by that particular user  from the Linux server. Here we are going to see on how to delete a user and precautions to be taken when deleting users. Lets start deleting user with examples.

Example: Delete user account from a machine

userdel username
or
deluser username 

Example:
userdel rajesh

The disadvantage of the above command is that it only deletes users login details but not his home directory.

Example: Deleting user account and his home directory from a Linux machine

userdel -r username
userdel –r rajesh

-r stands recurse for remove home directory.

Example: Delete user account forcefully though user logged in.




deluser –force username


deluser –f rajesh



No comments:

Post a Comment