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:

  1. Remove a user using GUI
  2. Remove a user using the Terminal

Prerequsites

  • Debian or Ubuntu system Desktop or Server.
  • This has been tested with Ubuntu 20.04 and Ubuntu 22.04 and Debian 10 and Debian 11. the same steps should work in newer versions too, we will test the steps on a regular basis and keep this guide updated.

Remove user using GUI

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.

<img alt="Linux Desktop" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1133.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="397" src="data:image/svg xml,” width=”880″>

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.

<img alt="Users settings" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1134.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="589" loading="lazy" src="data:image/svg xml,” width=”976″>

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.

<img alt="Unlock user manager" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1135.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="485" loading="lazy" src="data:image/svg xml,” width=”979″>

It will ask you to enter the account password for authentication. Enter the login account password and click on ‘Authenticate’.

<img alt="Authenticate as admin" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1136.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="688" loading="lazy" src="data:image/svg xml,” width=”983″>

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:

<img alt="Remove user" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1137.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="693" loading="lazy" src="data:image/svg xml,” width=”984″>

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.

<img alt="Keep files when removing a user from Linux" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1138.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="687" loading="lazy" src="data:image/svg xml,” width=”981″>

Now, you will see that the selected user has been removed from your Linux system.

<img alt="User removed successfully" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1139.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="683" loading="lazy" src="data:image/svg xml,” width=”978″>

Remove a user using the Terminal

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:

<img alt="Open a Terminal window" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1140.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="482" loading="lazy" src="data:image/svg xml,” width=”977″>

Click on the Terminal. You will see the following Terminal screen on your system. Now, you can run commands on it.

<img alt="Ubuntu and Debian Terminal console" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1141.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="615" loading="lazy" src="data:image/svg xml,” width=”869″>

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

<img alt="Delete user" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1142.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="228" loading="lazy" src="data:image/svg xml,” width=”863″>

Delete the user along with its home directory

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

<img alt="Deleting User" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/word-image-1143.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="254" loading="lazy" src="data:image/svg xml,” width=”862″>

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.