# How to create a user in Ubuntu

You can create a user on Ubuntu in just a few steps. Once you’ve created a user, you can add the new account to a `sudo` group if needed.

## How to create an Ubuntu user and give them `sudo` rights

With the [Linux sudo command](https://www.ionos.ca/digitalguide/server/configuration/linux-sudo-command/) users can initiate instructions at the root. They get **temporary admin privileges**, which an admin grants to an existing account or while creating a new user in [Ubuntu](https://www.ionos.ca/digitalguide/server/know-how/ubuntu-the-linux-system-for-everyone/).

Below we explain how to create a new user with `add user` in Ubuntu 20.04 and then how to **add them to the sudo group**.

### Executing `adduser` in Ubuntu 20.04

If you want to create a new user in Ubuntu, first you’ll have to **log into your server**. To do so, use the following command, replacing the placeholder “your\_server” with the IP address of your server:

```bash
$ ssh root@your_server
```

Next, use the `adduser` command to create an Ubuntu account for a new user. In our example, the user is named “robin”.

```bash
# adduser robin
```

The system will now prompt you to choose a [secure password](https://www.ionos.ca/digitalguide/server/security/protect-sensitive-data-with-a-strong-password/) for the new user. Type the password in after the colon and repeat it in the next line:

```bash
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
```

Then you’ll be asked to enter some information about the new user. You can also skip this step. When you’re finished, confirm with \[Y\].

```bash
Changing the user information for robin
Enter the new value, or press ENTER for the default
	Full Name []:
	Room Number []:
	Work Phone []:
	Home Phone []:
	Other []:
Is the information correct? [Y/n]
```

If you want to create additional Ubuntu users, repeat those steps.

### Assigning `sudo` privileges to the account

If you want to give sudo privileges to a new or existing account, you’ll need to **add it to the `sudo` group**. You should only do this for users you know and trust. By default, all accounts in the group get **full sudo privileges**. For our user “robin”, the command will look as follows:

```bash
# usermod -aG sudo robin
```

Don’t forget to substitute “robin” for the name of your user.

### Checking `sudo` privileges

After you’ve created the new Ubuntu user and added them to the `sudo` group, you can make sure the process was successful with the following command:

```bash
# su - robin
```

That command changes to the profile of the new user. Now execute a command that requires `sudo` privileges. The following command **grants access to the root directory**, which is only accessible for sudo users:

```bash
$ sudo ls -la /root
```

Then you’ll be asked to enter the password for this account. If the account is part of the `sudo` group, you’ll now have access to the /root directory.

Note Make sure that you only use root access when it’s absolutely necessary and take into account system security. Ideally, you should work with a non-root account that has `sudo` privileges.


This is a markdown version of: [https://www.ionos.ca/digitalguide/server/know-how/create-users-in-ubuntu/](https://www.ionos.ca/digitalguide/server/know-how/create-users-in-ubuntu/) for AI/LLM consumption.