Grid Guides

Explore How System On Grid Can Work For You

Grid GuideGrid Guide Topics

How to Create a Sudo User on Ubuntu

Table of Contents


The Sudo command grants administrator privileges. Generally, It is only available to the root user to the Normal users. In this guide, we are showing the easiest way to create a new user with sudo privileges on Ubuntu.


Running Server

Steps to Create a New Sudo User

Step 1

To Log in to your server as the root user enter the below command.

local$ ssh [email protected]_ip_address

Step 2

If you want to add a new user to your system then use the adduser command. You have to put username of the user in place of username as shown below.

# adduser username

You have to set the password at the prompt and confirm it. Note that a strong password is highly recommended as shown below.

Follow the prompts if you want to set the new user’s information. And you have to accept the defaults to leave all of this information.

Step 3

To add the user to the sudo group use the below command.

$ usermod -aG sudo username

In Ubuntu, By default, the members of the sudo group have sudo privileges.

Step 4

If you want to test sudo access to the new user account then test it using below command.

# su - username

Now you are a new user, you can test that you can use sudo by adding sudo to the command like this.

username$ sudo command_to_run

For example, If you want to list the contents of the /root directory, which is usually accessible to the root user.

username$ sudo ls -la /root

If you use sudo in a session for the first time, then you will be prompted to a password of the user account. Enter the password to proceed further.

If the user entered the correct password and he is an inexact group then that user will have sudo with root privileges.


Now the user has sudo privileges.