How to Add and Remove Users on Ubuntu 22.04

How to Add and Remove Users on Ubuntu 22.04

One of the most essential tasks of a system administrator is to learn the method to add and remove users on a Linux-based system such as Ubuntu 22.04. By default, when you start a new system, the access related to the root account is given to you. However, Ubuntu 22.04 system also permits you to add or remove additional unprivileged accounts for any additional users using terminal and GUI settings.

This write-up will demonstrate the procedure to add and remove users on Ubuntu 22.04 using terminal and GUI. So, let’s start!

How to add users on Ubuntu 22.04 using terminal

In the Ubuntu terminal, the process of adding users is pretty straightforward. The first thing you need to do is hit “CTRL+ALT+T” to open the terminal and then execute the “adduser” command with the name of the new user you want to create.

For instance, in our case, we are going to add a “testuser” with the help of the below-given “adduser” command:

$ sudo adduser testuser

You will be then asked to enter a new “password” for the newly created “testuser”:

How to Add and Remove Users on Ubuntu 22.04 1

Then, provide the following information related to the newly created user account if necessary and hit “y” to verify that the entered information is correct:

How to Add and Remove Users on Ubuntu 22.04 2

In the next step, we will add the newly created “testuser” to the “sudo” group by utilizing the following “usermod” command:

$ sudo usermod -aG sudo testuser

How to Add and Remove Users on Ubuntu 22.04 3

Lastly, we will verify if the “testuser” is successfully added to the “sudo” group or not:

$ groups testuser

The given output states that “testuser” is now a member of sudo group:

How to Add and Remove Users on Ubuntu 22.04 4

How to remove users on Ubuntu 22.04 using terminal

In Linux-based systems such as Ubuntu 22.04, the “deluser” command is used to remove users. In this command, you have to specify the “username” as follows:

$ sudo deluser testuser

When the above-given “deluser” command is executed without any option, it will remove the “testuser”; however, the directory of the specified user account will not be deleted:

How to Add and Remove Users on Ubuntu 22.04 5

To remove the user as well as its directory from your Ubuntu 22.04 system, add the “–remove-home” option in the same “deluser” command:

$ sudo deluser –remove-home testuser

How to Add and Remove Users on Ubuntu 22.04 6

Now, let’s check out the GUI method of adding and removing users on Ubuntu 22.04.

How to add users on Ubuntu 22.04 using GUI

Most of the users prefer to utilize GUI over the terminal to configure accountrelated settings? If yes, then you are at the right place! This section will teach you the procedure to add users on Ubuntu 22.04 using GUI.

For this purpose, firstly, open up the system “Settings” by searching it manually in the “Activities” menu:

How to Add and Remove Users on Ubuntu 22.04 7

In the left-side panel of the opened window, look for the “Users” in between the other categories:

How to Add and Remove Users on Ubuntu 22.04 8

Then, click on the “Unlock” button for adding users or changing settings:

How to Add and Remove Users on Ubuntu 22.04 9

Enter your system password for the authentication:

How to Add and Remove Users on Ubuntu 22.04 10

Then, click on the below-given highlighted “Add user” button:

How to Add and Remove Users on Ubuntu 22.04 11

Upon doing so, the following window will appear on the screen asking you to enter the details related to the new user account such as “Account type”, “User name”, “Full name”, “Password”. After filling the mentioned fields click on the “Add” button:

How to Add and Remove Users on Ubuntu 22.04 12

Viola! A new user named “testuser” is successfully added to the Ubuntu 22.04 system:

How to Add and Remove Users on Ubuntu 22.04 13

How to remove users on Ubuntu 22.04 using GUI

Similar to the process of adding users, you have to “Unlock” the account setting if you want to remove a specific user from your Ubuntu 22.04 system. To do so, firstly hit on the “Unlock” button and then click on the user account which you want to remove:

How to Add and Remove Users on Ubuntu 22.04 14

Type out the system password for authentication:

How to Add and Remove Users on Ubuntu 22.04 15

Scroll down through the account settings of the opened account and click on the “Remove User” button:

How to Add and Remove Users on Ubuntu 22.04 16

Now, a confirmation dialog box will ask you to confirm whether you want to delete or keep the files of the user account. Click on the “Delete Files” button to move ahead:

How to Add and Remove Users on Ubuntu 22.04 17

 

As you can see, the “testuser” account has been successfully removed from our system:

How to Add and Remove Users on Ubuntu 22.04 18

We have compiled the simplest method to add and remove users on Ubuntu 22.04 with the help of the terminal and GUI.

Conclusion

On Ubuntu 22.04, utilize the “$ sudo adduser username” command for the purpose of adding a user to the system. After that, you can grant “sudo” Privileges to the newly created user. Whereas, the “$ deluser username” command assists in deleting the specified users from the system. In the case of GUI, the system “Settings” has a “Users” category that offers the options related to adding and removing users. This write-up demonstrated the procedure to add and remove users from Ubuntu 22.04.

Leave a Comment

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