Categories: Ubuntu

How to Delete User on Ubuntu

Ubuntu is a well liked and widely used Linux distribution which allows you to add and delete use. Ubuntu is an operating system that handles several people who can use the system at the same time. When you install the Ubuntu system you need to create the user and you can add users later after installation of the system. But if you want to remove any users then Ubuntu allows you to delete the user using sudo privileges. In this Article our main focus will be on how to remove a user from Ubuntu using two approaches: Deleting user using Graphical Interface and Deleting user using Command Line.
Sponsored

Follow any of the approaches you find easier.

Deleting User Using Graphical Interface

As a beginner of Ubuntu you will find this approach a way easier. Follow the steps below to remove user using GUI on Ubuntu System:

Step 1: Open setting
Firstly you need to open the Settings by opening “Activities” and typing setting in search bar and click on Settings icon:

Or you can left click on the desktop screen of Ubuntu a drop-down list will appear, click on Settings option.

Step 2: Open Users setting
After the setting window will appear click on “Users” from list on left side, then on “Unlock…”:

Step 3: Remove User Account
In the Users setting, the system users will be shown on the screen.Then, at the bottom of the page, click the “Remove User…” button next to the user you wish to delete. Below I am removing “linuxhint” user from my system:

Now a dialogue box will appear asking you to select an option. To remove all files of the user you want to delete then choose Delete Files option, but if you want to store the files of the user for later use then choose Keep Files option.

And user will be removed from list of users as shown below:

Sponsored

Deleting User using Command Line

If you are a Command Line user this method is for you. You can also remove the user by writing commands on the terminal.

Step 1: List users
First check all the users registered on your system, the users are recorded in /etc/passwd, with the user account name as the first column.To see a list of existing user accounts, use the cat command, as seen below:

$ cat /etc/passwd

Step 2: Remove user
The “deluser” command is used for deleting or removing a user account from Ubuntu. The deluser command should be given the user account name. We also need capabilities to delete user accounts, which we can get by logging in as root or executing the sudo command as a regular user.

$ sudo deluser

Below mentioned is the command to delete “linuxhint” user from my system:

$ sudo deluser linuxhint

Step 3 : Check User
Now check whether the user is deleted by below mentioned command:

$ cat /etc/passwd

From above shown results we can check that “linuxhint” user no longer exists.

Conclusion

Ubuntu is an open source multi-user Linux distribution which provides several functionalities.It lets you add and remove users at any moment. In this Article, two approaches to delete the user from Ubuntu system are discussed; first is by GUI method and second is by Command line method using “deluser” command. To successfully delete the user, you can use any of the methods outlined in this article.

Ubuntu Server Admin

Recent Posts

How to Fix VMware’s “Could not open /dev/vmmon” Error on Ubuntu

You’ve recently installed VMware Workstation on your Ubuntu system and encountered the frustrating “Could not…

4 hours ago

How to Fix Ubuntu 404 Errors While Fetching Dependencies

Have you ever found yourself staring at a terminal full of 404 errors while trying…

4 hours ago

How to Fix ‘Please Install All Available Updates’ Error When Upgrading Ubuntu 18.04 to 20.04 LTS

One particularly frustrating error that many users face when trying to upgrade from Ubuntu 18.04 …

4 hours ago

How to fix “Release is not valid yet” Error in Docker Containers

In the world of containerization, time synchronization issues can create unexpected roadblocks when working with…

4 hours ago

How to fix “Externally Managed Environment” Pip Errors on Ubuntu

If you’ve recently upgraded to Ubuntu 23.04 or newer, you might have encountered a frustrating…

4 hours ago

Ubuntu now officially supports NVIDIA Jetson: powering the future of AI at the edge

Canonical announces the General Availability of Ubuntu for the NVIDIA® Jetson Orin™ for edge AI…

11 hours ago