How to Delete a User on Ubuntu

Using this guide, you will learn how to delete a user on the Ubuntu operating system.

Delete user on Ubuntu

There are times in which you may want to remove a user from your operating system.

Luckily deleting a user on all versions of Ubuntu is a straightforward process.

In this tutorial, we will show you the steps for deleting a user using both the terminal and desktop interface of Ubuntu.

To delete users on Ubuntu you will need to have superuser privileges or access the root user.

Deleting a User on Ubuntu Using the Command Line

The first method will show you is how to delete a user using the command line.

Using the command line is a very straightforward process and should be simple enough even for people who aren’t too familiar with using the terminal.

You can open the terminal quickly within Ubuntu’s desktop interface by using CTRL + ALT + T. It is also possible to use these commands over your Ubuntu’s SSH connection.

There are two different commands that you can use to delete a user on Ubuntu. The first is the userdel command. The other is deluser command.

For this guide, we will be focusing on using deluser, which is the interactive and ever so slightly easier to use version of userdel.

Deleting a User Using deluser

Using the deluser command, we can delete a user on our Ubuntu system with ease.

This command is available on most Linux-based operating systems, so it is good to learn how to use it.

1. At its most basic usage, all you need to do is specify the user you want to delete.

When using this command, make sure that you replace “[USERNAME]” with the user’s name you want to delete.

deluser [USERNAME]

2. For example, if we wanted to delete a user called “pimylifeup“, you would use the following command.

sudo deluser pimylifeup

3. When you delete a user successfully, you will receive a message similar to what we have below.

Removing user `pimylifeup` ...
Warning: group `pimylifeup` has no more members.
Done.

You can see that it removed the user, and in our case, the group that was created with it no longer has any members

As the group has no more members, it was automatically deleted by deluser.

Deleting a Home Directory using deluser

You can also use deluser to delete the home directory belonging to the user you want to delete from Ubuntu.

All you need to do is append --remove-home to the deluser command.

deluser --remove-home [USERNAME]

Now when you utilize this command, Ubuntu will delete the user’s home directory alongside the user.

Be careful when using this argument, as the data will not be recoverable after running.

Using Ubuntu Desktop Desktop to Delete a User

Deleting a user on Ubuntu using the desktop interface takes a few extra steps compared to using the terminal.

This is because you will need to open up the Users settings panel, unlock the panel, and then select and delete the user.

We have steps for both Ubuntu 18.04 and Ubuntu 20.04. Use our guide for checking the version of Ubuntu if you are unsure what you are running.

These steps should also be somewhat similar for most versions of Ubuntu. You will need to find the user settings interface.

Deleting a User using Ubuntu 20.04 Desktop Interface

The first version of Ubuntu that we are going to explore is Ubuntu 20.04.

Deleting a user on this version of Ubuntu is a straightforward process that requires us to access the user settings page.

1. To delete a user on Ubuntu 20.04, we need to get to the settings page.

One of the fastest ways of getting to this is by clicking the screen and power icons on the screen’s top right.

Opening the Actions Panel

2. You should now see a panel pop up on the top right of the screen.

On this panel, you need to click the “Settings” option.

Select Settings Open in Panel

3. In the sidebar, you should see “Users“, click it.

You may have to scroll down in the sidebar to find this option.

Change to the User Settings Page

4. Before we can delete a user on Ubuntu 20.04, we need to unlock the settings.

To unlock the user settings, click the “Unlock...” button.

Unlock Ubuntu 20.04 User Settings

5. To continue, you will need to authenticate your current user.

To do this, you will be asked to enter your account’s password (1.).

Once you have entered the password, click the “Authenticate” button (2.).

Authenticate as Administrator

6. Now, select the user that you want to delete.

You should see a “Remove User...” button at the bottom of the “users” page.

You need to click this button to delete this user on Ubuntu.

Delete User on Ubuntu 20.04

7. The final decision you need to make when you delete a user on Ubuntu is whether you want the files to be deleted.

To delete the user’s files, you will need to click the “Delete Files” button (1.).

Alternatively, if you don’t want the files to be deleted, you can click the “Keep Files” button (2.).

Delete user on Ubuntu 20.04

Using Ubuntu 18.04’s Interface to Delete a User

This section will show you how to delete a user within the Ubuntu 18.04 desktop interface.

To manage and delete users within Ubuntu, you will need to access the user settings page.

1. Start by clicking the network and power icons located at the top right of the screen.

Open Power Quick Panel

2. Clicking these icons will bring up an extra panel that will allow you to get to the settings page quickly.

To open the settings, we need to click the “spanner and screwdriver” icon.

Open the Ubuntu 18.04 Settings Page

3. We need to switch to the “Details” tab where the user settings are located.

Please scroll down the sidebar till you see the “Details” option, then click it.

Scroll down and Select Details Tab

4. Now that we are in the details panel, we need to change to the “User” tab.

Find “Users” in the sidebar, then click it.

Opening the user Settings on Ubuntu 18.04

5. Before we can delete a user on Ubuntu, we need to unlock the settings page.

At the top of this page is an “Unlock” button. Click it to continue.

Unlock Admin Settings

6. You will now be required to enter the password (1.) for your account.

With your password entered, click the “Authenticate button (2.).

Authenticate as superuser

7. Now that you have unlocked the user settings page, we can now delete users.

Select the user on Ubuntu that you want to delete, then click the “Remove user...” button at the bottom of the page.

Delete user from Ubuntu 18.04

8. Before the user is deleted, you will get a chance to decide if you want to delete these files.

If you want to remove all of the user’s files, click the “Delete Files” button (1.).

Alternatively, if you want to keep the user’s files, click the “Keep Files” button (2.).

Choose whether to delete users files

Conclusion

At this point, you should now have an idea of how you can delete a user on an Ubuntu-based operating system.

The steps for deleting users are a reasonably straightforward process that can be done easily on both the terminal and desktop interfaces.

If you have run into any issues with deleting a user, please leave a comment below.

You can also create users on Ubuntu just as easily as you can delete them.

Be sure to check out some of our other great Linux tutorials or Ubuntu guides.

Leave a Reply

Your email address will not be published. Required fields are marked *