Ubuntu

How to Create a New User on Ubuntu 20.04

Like all major operating systems, Linux is a multi-user operating system that lets users to have their own separate accounts. Each user has its own Home directory which contains all the data and settings specific to that user and is not accessible to any other user. Knowing how to create a new user account is a basic but important task that every Linux user should know.

This article will explain to you how to create a new user on Ubuntu OS through the UI and the Command line. Also, we will explain how to assign sudo privileges to the user and how to delete it in case you want to. We have run the commands and procedure explained in this article on a Ubuntu 20.04 LTS system.

Note: In order to add or delete a user account, you must have administrator privileges.

Creating the User Account using UI

To create the new user account via UI, follow these steps:

  1. Open the Settings utility using the right-click menu from desktop.

  1. Then navigate to the Users tab from the left panel. On the right panel, you will see all the fields disabled by default. To make any changes, you will need to unlock the settings. In the top right corner, hit the Unlock button. The following Authentication dialog box will show up. Type the password and click the Authenticate button. By doing so, all fields will be enabled.
  2. Next, click the Add User button.
  3. The following dialog box will open asking you to enter the required information for the new user to be created. You can choose to create a Standard or an Administrator account by selecting the tab in front of Account Type. Administrator account has more privileges than the standard user account and they can install, remove and update software, add and remove users and make configurations.Type the user name and set a password for it or let the user set it when they next log in. Then click the Add button.

    Now the user account has been created and you will see it listed in the Users window.

Deleting the User Account using UI

If you want to delete the user account using the UI, follow the below simple steps:

  1. Open the Settings utility using the right-click menu from desktop.
  2. Then navigate to User tab. On the right panel, you will see all the fields disabled by default. To make any changes, you will need to unlock the settings. In the top right corner, hit the Unlock button.
  3. In the following authentication dialog, type password and click the Authenticate button.
  4. Select the account you want to remove and hit the Remove User button. Next, it will ask if you want to keep or remove the Home directory of user. You may choose to remove or keep the files through the corresponding buttons.

After that, the user account will be removed from your system.

Creating a User Account using the Command Line

To create a new user account using the Command line, follow the below steps:

  1. Hit Ctrl+Alt+T to launch the command line Terminal application in Ubuntu.
  2. Now in order to create a new user account, use adduser command as follows:
$ sudo adduser <username>

Replace <username> with your new user account name that you want to create.

As an example, we are creating the user account with the name “guest”, so the command would be:

$ sudo adduser guest

Enter the sudo password. Then type and re-type the password for the new user account. You can provide other information or press Enter to accept the default.

Once done, you will be asked to confirm the information by providing with Y/n option. Hit y to confirm, after that the user account will be created in your system.

  1. Once added, you can verify the newly added user account with the following command:
$ cat /etc/passwd | grep <username>

  1. If you want to grant sudo privileges to the user, you can do so with the following command:
$ sudo usermod –aG <username>

In our example, it would be:

$ sudo usermod –aG guest

It will add the user to the sudo group and will assign administrative rights.

Deleting the User Account using the Command Line

In order to delete the user account using the command line, use the following syntax:

$ sudo deluser <username>

That is all there is to it! I hope this will be helpful if you ever need to create a new user account in Ubuntu 20.04 LTS system.

About the author

Karim Buzdar

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn.