When using Debian or Ubuntu operating system on your server or desktop, you sooner or later will have to add or remove users from your system. This article will guide you on how to remove a user from the Debian or Ubuntu Linux distribution using the graphical user interface as well as through the Terminal. So, let’s go into the details.
Using the two different ways you can remove a user from Linux:
Prerequsites
To remove a user using the graphical interface, click on the down arrow sign which is located at the top right corner of your desktop, and then click on the setting icon from the displaying drop-down list.
Now, from the displaying window, click on the search icon that is highlighted red in the following screenshot and type the ‘Users’ keyword in the given search bar.
Click on the ‘Users’ icon that is displayed in the search result.
Now, you need to unlock the current login account. For this purpose, click on the 'Unlock' button as shown in the following screenshot.
It will ask you to enter the account password for authentication. Enter the login account password and click on ‘Authenticate’.
Note: Only a sudo user or administrator can remove a user from your system. So, it is assumed that you are currently login from your administrator account.
Select the user that you want to remove from your Debian or Ubuntu system and click on the ‘Remove User’ which is highlighted in the following image:
As you click on the ‘Remove User’, the following prompt will display on the system that will ask you whether you want to delete all associated files or want to keep them. Click on the ‘Delete Files’. It will delete the user with all its associated files from your system.
Now, you will see that the selected user has been removed from your Linux system.
Linux users who prefer to use the Terminal to perform each task can also remove the user using the Terminal. For that purpose, you need to open the Terminal application on your system. Click on ‘Activities’ and search Terminal with the help of the application search bar as follows:
Click on the Terminal. You will see the following Terminal screen on your system. Now, you can run commands on it.
To delete a user run the following command on the Terminal:
$ sudo deluser user-name
Replace the user name with the user that you want to remove. Here, we are removing a user ‘sam’ from the system.
$ sudo deluser sam
You can also remove the user along with the user’s directory from your system by using the following command:
$ sudo deluser --remove-home user-name
For example, if you want to remove user ‘sam’ along with the directory, then the above command will be changed in the following command:
$ sudo deluser --remove-home sam
To remove a user with all its associated files from your system, use the following command:
$ sudo deluser --remove-all-files user-name
Replace the user name with the user that you want to delete along with all associated files.
that's it, you successfully removed an account from your Debian or Ubuntu system.
Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…
ISPConfig is an open-source control panel that allows users to manage multiple servers from a…
As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…
Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…
Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…
phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…