Create a New User in Ubuntu 22.04 or 20.04 using GUI or Terminal

In this tutorial, we will learn the steps to create a new user in Ubuntu 22.04 Jammy JellyFish or Ubuntu 20.04 Focal fossa either using the command terminal or GUI- Graphical user interface.

Like windows, we can add users on Ubuntu 22.04 or 20.04 with different rights such as one with sudo and another without. This helps multiple users to work on the same system while their files and directory can only be accessible by them. Although the root or Super Admin user can access any other system/regular user account and its files, the standard/regular user account cannot. The process of creating a new user is not much difficult even on Ubuntu Linux. We can use the terminal or GUI interface of the OS to do that. Apart from creating a user on Ubuntu 22.04, we will also learn how to assign sudo rights to a user using this step-by-step guide.

Steps to create a new user in Ubuntu 22.04 or 20.04 Linux

Note: To use the command or GUI for adding a new user, you should already have root or a user with sudo rights.

#1st Using the terminal:

1. Acess Terminal

If you are using a CLI interface of Ubuntu 22.04 Server or want to use the Terminal app on GUI Linux to create a new user, then first access the same. Those who are using a GUI Ubuntu Desktop can use the keyboard shortcut Ctrl+Alt+T.

2. Add a new user on Ubuntu 22.04

Now, to add a new user using the terminal use the command called adduserWell, the command itself explains everything, it is easy to remember and needs to be executed with sudo and the name of the user you want to add.


sudo adduser username

For example, if we want to add a user named- h2smedia, then the command will be:

sudo adduser h2smedia

Just replace the h2smedia with the username that you want to add.

Add a new user on Ubuntu 22.04

As you run the command, the system will ask you to enter your user (sudo) password to execute the command. After that type the password that you want to set for your newly created user.

Once the password is set, it further asks for some more information such as the Full name of the user, phone number, and others. If you want to set them then enter the required values otherwise simply press the Enter key again and again until you get the “Is the information correct? [Y/n]” question. Type Y and hit the Enter key again to create the new user.

3. Check user added successfully or not

Now, to confirm that the user has been created successfully, use the given command:

cat /etc/passwd | grep user

Replace the user with the one you have created in the above command.

Check Linux user added successfully or not

4. To List all users on Ubuntu 22.04 or 20.04

Whereas to list all available users, we can use:

cut -d: -f1 /etc/passwd

For only all normal (non-system etc) users:

awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd

5. How to assign Sudo to a user

Now, if you also want to give sudo rights to your newly created so that it can execute the command with Admin rights then that is also possible. Simply, add your user to the sudo group.

sudo adduser user sudo

For example, here we have a user h2smedia and if we want to provide it sudo rights then the command will be:

sudo adduser h2smedia sudo

6. Revoke or remove sudo rights

Well, maybe later you want to revoke or remove the sudo access given to the created or from any existing user. For that we can go for the given command syntax:

sudo deluser user sudo

For example:

sudo deluser h2smedia sudo

7. Change user name

The username can be easily changed using

sudo usermod -l new-username old-username

For example:

sudo usermod -l myh2s h2smedia

However, this is only possible if the user name to be changed is currently not active (i.e. not logged on to the system).

8. Delete a user from Ubuntu 22.04

Perhaps later you don’t require some user on your Ubuntu Linux system, in such a case we can delete them even the one you have created. For that the command syntax will be:

sudo deluser user

For example:

sudo deluser h2smedia

Delete user including data from the home directory:

sudo deluser --remove-home h2smedia

#Using GUI to create a user

9. Open Ubuntu Settings

If you want to add a new user account, you can easily control everything via the graphical user interface. First, open System Preferences. You can achieve this, for example, by clicking on one of the icons in the status menu, which is located in the upper panel on the far right. From the pop-up menu, select Settings.

Open Ubuntu Settings

In the new window, navigate to the Users section in the left pane. Now unlock to add users and change settings via the button of the same name displays further as an option. After you have legitimized yourself with your password, click Add User Account.

unlock to add user and change settings

10. Add a User account using Ubuntu 22.04 GUI

Then select the account type. The default is a Standard account, which should be enough for most use cases, especially if you need a limited account to test. If further authorizations as an admin or sudo are required later, you can also change the role later from Standard to Administrator.

Add a User account using Ubuntu 22.04 GUI

You then set the full user name and the user name. When you type in the full name, the user name is automatically populated based on it. Spaces are omitted here.

Finally, it is still necessary to regulate password assignment. You can leave it to the user to choose a password the first time they log in. However, you can set it manually by yourself for the new user.

Add a User account using Ubuntu 22.04 GUI

The strength of the password will evaluate by the system using colored bars. If you prefer to have a random password generated, click on the small icon at the end of the password field.

Generate random password for Ubuntu user

After you have set all the options, click on the Add button at the top right of the dialog. Provide your system password to execute the task. You will then be taken back to the main window. There you have another opportunity to check the settings for the new user account and, if necessary, to make corrections.

11. Remove User (optional)

In case you want to remove the added or existing standard user account using GUI then that is also possible. Go to the Users, select the account you want to delete and then click on the Remove User button.

Remove user in Ubuntu 22.04


How do I list all users in Ubuntu?

Open the command terminal in your Ubuntu Linux and execute the command cut -d: -f1 /etc/passwd

How many types of users are there in Linux?

There are three types of user accounts in Linux- one is Root user account and the others are a Regular user account, and a Service account.

The root user account is the main super admin account on Linux created automatically during the installation of the OS. It has access to the whole system, services, and files. In short, we can do any administrative work using it. Hence, if required can be disabled but we cannot delete it.

A regular user account is created automatically or we can create one manually with moderate privileges. This type of account cannot execute Admin tasks until sudo rights are not provided.

Service accounts are created by installation packages.

How do I remove a user from Ubuntu?

To remove or delete any existing user from Ubuntu open your terminal and run the given command:

To delete only the user:

sudo deluser username

To delete the user and all its data stored under its home directory:

sudo deluser --remove-home username

How do I change users in the terminal?

To change the user account without logging out of the system in the terminal, we can use the su command. Here is the syntax:
su username
For example:
su h2smedia

What happens if you delete Users in Linux?

If you have used the command to only delete the user then the system will only remove the user but not its folder and files residing under its home directory. However, if deleting the user along with all its files then the system will clean all files created by that user account.

When Users are deleted what happens to their files Linux?

Nothing will happen to the files of the deleted user unless you execute a command to delete the files as well. But if you have opted for deleting all data along with the user then the system will also remove all files and folders of the deleted user.

Other Articles:

How to install sudo on Debian or Ubuntu Linux
2 Ways to add users to a sudoers group in Debian 11
How to change Ubuntu Linux name Graphically
How to change the Computer name in Ubuntu 20.04 Linux

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.