How to add and remove users on Ubuntu 22.04

Effortlessly manage your Ubuntu user accounts with our comprehensive guide on adding users. Learn how to create new user profiles, set permissions, and enhance system security. Seamlessly expand your Ubuntu user base today!

Updated: 31 Jul, 23 by Susith Nonis 5 Min

List of content you will read in this article:

Learning the technique to add and remove users on a Linux-based system like Ubuntu 22.04 is a crucial responsibility of a system administrator. 

Upon initializing a new system, the root account's access is granted to you by default. Nonetheless, the Ubuntu 22.04 system enables you to add or delete more accounts for other users. 

This article will showcase the steps to add users on Ubuntu on Ubuntu 22.04 and remove them with a terminal and GUI. 

In the Ubuntu terminal, it’s quite easy to add a user. Initially, you must press “CTRL+ALT+T” to launch the terminal, and then use the “adduser” command with the name of the fresh user you desire to generate. 

To illustrate, in our scenario, we will add a “testuser” using the “adduser” command below:

sudo adduser testuser

Subsequently, you will be prompted to input a fresh “passcode” for the recently generated “testuser”. 

Afterwards, complete the subsequent details about the recently established user account, if required, and select “y” to authenticate the accuracy of the provided data.

In the next phase, you have to add the “testuser” you have created to the “sudo” group with the help of the “usermod” command:

sudo usermod -aG sudo testuser

Finally, you can confirm whether the addition of "testuser" to the "sudo" group was successful or not:

groups testuser

For Linux-based operating systems like Ubuntu 22.04, the "deluser" command is utilized for deleting users. To execute this command, you need to indicate the "username" in the following manner:

sudo deluser testuser

If you execute the "deluser" command without any parameter, it will eliminate the "testuser" from your system, but it won't erase the directory related to the user account. 

To delete both the user and the directory, you can include the "--remove-home" option in the "deluser" command in your Ubuntu 22.04 system.

sudodeluser --remove-hometestuser

Most users opt for GUI instead of the terminal for adjusting account settings. If you belong to this group, you have come to the correct spot! 

This segment will guide you on how to add users on Ubuntu 22.04 through GUI. To begin with, locate the system "Settings" by conducting a manual search in the "Activities" menu.

In the panel on the left side of the window, search for the category labelled “Users” among the other options available. 

Subsequently, select the “Unlock” option to modify settings or add new users. Provide your system password to authenticate the action. 

Next, select the highlighted button labelled “Add user” located below. Once you have clicked on the button, a new window will appear, prompting you to enter details for the newly created user account, such as “Account type”, “User name”, “Full name”, as well as “Password”. 

After filling in the required fields, click the “Add” button to proceed.

🚀 Elevate your website's performance to new heights with our lightning-fast VPS hosting! 💻💨 Unleash the power of dedicated resources and enjoy seamless scalability for unbeatable online success. 🌐📈

Just like adding users, to eliminate a particular user from your Ubuntu 22.04 system, you need to "Unlock" the account setting. 

To achieve this, click on the "Unlock" option and then select the desired user account you wish to remove.

Enter the authentication code to access the system. Navigate to the account preferences of the active profile and select the option to "Remove User". 

Subsequently, a message will appear asking for confirmation on whether to retain or erase the user's data. Proceed by clicking on the "Erase Data" button.

Acquiring familiarity with adding and deleting users on a Linux system is among the most crucial system administration tasks. 

Upon creating a new system, the root account's default access is often limited. Although being logged in as the root user grants complete control over the system and its users, it can also be hazardous and potentially damaging. 

You should now be adequately equipped to add users on Ubuntu 20.04 system. Effective user management will enable you to segregate users and provide them only with the necessary access to perform their duties.

People also read: 

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.