Ubuntu, like most Linux distributions, offers multi-user support. This act is quite helpful when multiple users are sharing a single computing machine. The administrator can grant limited as well as full permissions to a user. Considering the importance, this post will provide a detailed guide to creating a new user on Ubuntu 22.04. The following methods are demonstrated in this guide:
Let’s discuss the first method:
Method 1: Creating a New User Using CLI on Ubuntu 22.04
In this method, we will use the basic commands to add a new user on Ubuntu 22.04. Let’s explain this method step-by-step:
Step 1: Add User
Press “CTRL+ALT+T” to open the terminal. Run the following command in Ubuntu 22.04 to add a new user with the name “davy“:
$ sudo adduser davy
During the execution, you will set the password for the user.
Moreover, it will ask you to enter other details like Full Name, Room Number, etc. If you don’t want to enter specific details, press the “Enter” key, it will set default values for the user.
Step 2: Verify the User
As the new user is added and details are set. We can verify if the user is added to the system or not using the below command with the newly installed user name “davy”:
$ id davy
The user id and group id show a new user is successfully created on Ubuntu 22.04.
Step 3: Add User to Sudoers Group (Optional)
The new user named “davy” is not in the sudoers file, so it will not be able to exercise the tasks that require administrative privileges. The following error will be thrown if the “sudo” is used with the newly created user:
To avoid this, you need to add the user (“davy” in our case) to the sudoers file via the command:
$ sudo usermod -a -G sudo davy
Note: Make sure that you are using the above command as a user that has administrative privileges. To switch between users, you can use the command “su – <username>”.
Method 2: Creating a New User Using GUI on Ubuntu 22.04
We can add a new user in Ubuntu 22.04 using GUI with the below-performed basic steps:
Step 1: Open the User Settings
Click the “Show Applications” option on the Dock panel of Ubuntu 22.04, you will be directed to the search menu. Enter “Settings” in the search bar, and click on the “Settings” menu:
Once you click on the Settings option, it will take you to the “User” settings. Now you can add a new user here.
Step 2: Get Administrative Access
Press “unlock” in the user settings window to get administrative access shown below:
For changing administrative settings like adding or removing a user, you need to authenticate:
Add your administrator user password and click “Authenticate” to access the administrator settings.
Step 3: Add a New User
Now, by clicking the “Add User” button below, we can add a new user.
Add the basic credentials, including the name, and set a password for the user’s security as shown below:
Once you click “Add” on the top right side of the above picture, a new user is created.
Note: The user can be added as an administrator or a normal user. If you want to grant administrator privileges to the user, you must opt for the “Administrator” option; otherwise, “Standard”.
Step 4: Verify New User From Interface
Click on “Users”, and it will show all the users working on the system. The user named “Miltox” is added:
A new user on Ubuntu 22.04 is successfully created in this section using GUI.
How to Remove User on Ubuntu 22.04?
Similar to adding a new user, we can remove a user on Ubuntu 22.04 using both CLI, and GUI approaches. We will elaborate on both methods one by one:
The following command will remove the user named “davy”:
$ sudo deluser davy
The error-free output shows that the user is successfully removed from Ubuntu 22.04.
User can be removed using GUI by going to the “Users”settings and clicking on “Remove User” as shown below:
User is successfully removed from Ubuntu 22.04.
Note: You must “unlock” the user settings to remove the user. For that, the administrator password will be required.
That’s the end of this guide.
A new user can be created on Ubuntu 22.04 by running the “$ sudo adduser <username>” command. Moreover, the GUI of Ubuntu 22.04 can also be used to create a new user. To add a user using GUI, navigate to the “Users” settings, authenticate as the “System Administrator”, and put in the required credentials. This post has briefly demonstrated the multiple methods to create a new user on Ubuntu 22.04.