Completely Delete A User Along With The Associated Home Directory In Ubuntu Linux

Advertisement

Whenever you create a user in Ubuntu it’s respective directory is created in the /home partition of the system. Whenever you remove a user the system deletes it’s entries from each and every location, except it’s relevant directory in /home. Linux Distributions do not remove the home directory of a user when the user is deleted. Let me guide you how to remove a user along with its home directory.

In order to confirm the above statement, Go to System > Administration > User and Group option. Here is the dialogue box which is displayed.

User-Accounts

New Users can be created from the Add user button and a user can be deleted from the Delete button. Here is message which is displayed when you delete user, it says that the  /home directory of the user will not be removed.

Home-Directory-Not-Removed

Now to remove a user along with its home directory, open the terminal and run the following command to delete the user completely.

sudo deluser –remove-home username

where “username” should be replaced with the name of the user that you wish to delete. Just as an example, in order to delete the user aun, run the command as follows:

sudo deluser –remove-home aun

That’s it. Enjoy!

Advertisement