How to delete users on Ubuntu 20.04

On Ubuntu 20.04 you can delete a user using the deluser command in the terminal or in the graphic user interface. Only root users and those with sudo privileges can delete a user and their files.

Who can delete a user on Ubuntu?

Only users with root or sudo privileges can delete users in Ubuntu. The same goes for adding new users on Ubuntu 20.04.

Create a professional email address
Discover a new way to email
  • Write perfect emails with optional AI features
  • Includes domain, spam filter and email forwarding
  • Best of all, it's ad-free

How to delete users on Ubuntu 20.04 in the terminal

One way to remove a user on Ubuntu is with the deluser command in the terminal.

Deleting users as root

If you are logged in as the root user you can remove any user with the deluser command. Simply enter the following code in the terminal and replace the placeholder ‘username’ with the user you want to delete:

# deluser username
bash

Now you’ve deleted the user, but their account data is still there. To delete this data as well, use the following command. It will delete the home directory and all the files in it.

# deluser --remove-home username
bash

Deleting users with sudo privileges

If you’re not the root user and want to delete a user on Ubuntu 20.04, enter the following code. Replace ‘username’ with the name of the user you want to delete.

$ sudo deluser username
bash

To delete the user’s files, use this command:

$ sudo deluser --remove-home username
bash

How to delete users on Ubuntu 20.04 using the graphic interface

Alternatively, users with sudo privileges can also delete a user using the graphic user interface. Follow these steps:

  1. Open the settings.
  2. Click on User.
  3. Click on Unlock… You’ll now be asked for your password. Enter it and then confirm.
  4. Select the user that you want to delete.
  5. In the bottom right, you’ll see a red button with white letters that says Remove User…. Click on it.
  6. You’ll be asked to confirm, and then whether you want to delete the user’s home directory. Make your selection, and the user will be deleted.
Deleting a user in the Ubuntu graphic user interface
Select the user that you want to delete.
Was this article helpful?
Page top