Debian

Remove Users in Debian 10

When you set up a fresh Debian 10 environment, you will need to learn how to do some basic tasks. Adding and removing users from the Debian system is one of these tasks.

This article will discuss how to remove or delete users from Debian 10 Buster using the command line, as well as the Gnome desktop interface.

You can remove a user from the Debian 10 buster using two different methods:

  1. Delete a user using the command line
  2. Delete or remove a user through Gnome desktop

Method 1: Removing a User with the Command Line

To remove a user using a command in the terminal, you first need to open the terminal. Click on ‘Activities’ and then type the keyword ‘terminal’ in the application search bar. Click on gnome-terminal from the following results.

Use the following command to remove a user from Debian 10 Buster:

$ deluser user-name

For example, if you want to delete a user named ‘sam’ from your system, then the above command will be converted into the following form:

$ deluser sam

Remove User and Directory

To delete a user along with the user’s directory, execute the ‘deluser’ command with the ‘-remove-home’ term.

$ sudo deluser --remove-home user-name

Remove User and All Associated Files

To remove a user along with all the files associated with that user, use the ‘deluser’ command with the ‘–remove-all-files’ term.

$ sudo deluser --remove-all-files user-name

Replace the ‘user-name’ term with the user you want to remove.

Remove User from sudoer File

If you deleted an admin user on Debian 10, there may be a chance that the user entry remains in the sudoers file.

So, to remove a user from the sudoers file, run the following ‘visudo’ command:

$ sudo visudo

You can search for the corresponding user that you deleted and remove the user line via the following command:

user-name    ALL=(ALL:ALL) ALL

Replace the ‘user-name’ term with the user that you want to remove. Save the file and make sure that this user is no longer a member of the sudo group.

Method 2: Removing a User with the Gnome Desktop

In this method, you can remove users from the system using the Gnome graphical desktop. To delete a user using the GUI, click the arrow sign from the top right corner of the desktop in Debian 10 Buster, and you will see the dropdown menu on the corner of the desktop. Click on the ‘Settings’ icon from the available dropdown menu items.

The following window will be displayed on the desktop. Click on the search icon from the left corner of the display window and type the keyword ‘users’ in the search bar.

Next, click on the ‘Users’ icon in the display window, as shown below:

The following window will be displayed on the system. To remove a user, you will need to unlock the current user for verification. Click on the top right corner button, ‘Unlock.’

You will see the following dialog prompt display on the screen. Here, you will enter the current administrator user password for authentication. Enter the password and click the ‘Authenticate’ button.

The following window will display on the screen. You can now remove the user from the system. Click on the user you would like to remove from the system. Here, the username ‘Debian user’ will be removed. ‘

Next, select ‘Remove User’ from the following display window:

When you click ‘Remove User,’ the following dialog will appear on the screen, asking you whether you want to remove all associated files with this user or keep them in your system. To delete the user and the associated files, click ‘Delete Files.’ Now, the user has been successfully removed from your system.

The user ‘Debian user’ has been deleted, as you can see in the following display window:

Conclusion

In this article, you learned how to remove users from Debian 10 Buster using two different methods: the command line and the GUI. Moreover, you also learned how to remove users from the sudoer file, as well as how to delete all files associated with a user. You can explore more commands related to user management on Debian 10. I hope you found this article useful for your needs.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.