Linux is a multi-user operating system that enables users to have their unique accounts, just like all other major operating systems. Each user has their home directory, settings, folders, and documents that are not accessible to other users. Therefore, adding a new user in Ubuntu is a basic task. Every Linux user should know how to create a new user account.
In this article, we’ll go through how to create a new user on the Ubuntu 22.04 Jammy jellyfish distribution using both the graphical GUI and the command line method. In addition, we’ll cover how to grant sudo access to the user and if necessary how to remove the user from Ubuntu 22.04.
Prerequisites
You need administrative or root privileges to add new user accounts in Ubuntu 22.04 distribution.
How to Add a User in Ubuntu 22.04 Using Graphical Interface?
You can add a user in Ubuntu 22.04 system via the graphical interface by doing the following steps:
- Open the ‘Activities’ overview sections and start typing ‘Users’ in the application search bar:
- Open the settings panel by clicking on the ‘User’ icon.
- Click on the ‘Unlock’ from the top right corner of your desktop and type the login user password when prompted.
- Click on the ‘Add user’ button to add a user in Ubuntu 22.04.
- Select the ‘Administrator’ account type if you want to create a user with administrative access to the system.
Note: The administrator accounts can do all administrative tasks like adding users, deleting users, assigning privileges to other users, installing drivers and software, and changing system settings.
- Now, enter the user’s full name. The username will be automatically filled. However, if you want to assign a new username, you can change this proposed username.
- Select ‘set password now’ and choose a password for the new user. Again, enter the password for confirmation.
- Now, click on ‘Add’ to submit information for the new user.
- The new user is added successfully to your Ubuntu 22.04 system. You will see that a new account is listed in the ‘Users’.
How to Add a User in Ubuntu 22.04 via Terminal?
You can add a new user in Ubuntu 22.04 system using the terminal or command line by executing the following steps:
Open the command line application ‘Terminal’ by using the keyboard shortcut ‘Ctrl+Alt +t’. You can also launch the terminal from the application menu.
Now, create a new user account. Execute the ‘adduser’ command on the terminal to add a new user in Ubuntu 22.04.
$ adduser user_name
Replace the ‘user_name’ with your new user account name. For example, here we are adding a new user account with the name ‘guestuser’.
$ adduser guestuser
Enter the ‘sudo’ password for adding a new user. Enter the password for adding a new user account. Type and retype the password for adding a user. Enter account details for a new user account or press ‘Enter’ to continue with the default options.
Next, you will be required to confirm the above input information by providing with Y/n option. Enter ‘y’ to confirm this new user account.
Finally, you added a new user in Ubuntu 22.04 system.
You can also verify the newly added user account by using the following command:
$ cat /etc/passwd | grep [username] $ cat /etc/passwd | grep guestuser
You can also grant administrative or sudo privileges to the new user by using this command:
$ usermod –aG sudo [username]
The above command will add the ‘guestuser’ into the sudo group and assign administrative privileges.
How to Delete a User From Ubuntu 22.04?
To delete a specific user from Ubuntu 22.04, you can use the following syntax:
$ sudo deluser [username]
For example, if we want to delete user ‘guestuser’, use the above command in the following way to delete this user account:
$ sudo deluser guestuser
Conclusion
We learned from this tutorial how to add a user in Ubuntu 22.04 system by using the command line or via GUI. Moreover, we demonstrated how to grant sudo access to a user and delete a user from Ubuntu 22.04 Jammy jellyfish distribution.