Create a Sudo User on Ubuntu

Reading Time: < 1 minute

Today, I will use Ubuntu 16.04.5 LTS for this example in creating a Sudo user. Just make sure you have access to your root user, via SSH. 

adduser sudo-user

Be sure to replace sudo-user with your desired username.

Set password prompts:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Set and confirm the new user’s password at the prompt. A strong password is highly recommended!

User information prompts:
Changing the user information for username
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]

Follow the prompts to set the new user’s information. It is fine to accept the defaults to leave all of this information blank.

Use the usermod command to add the user to the sudo group.

usermod -aG sudo sudo-user

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

Use the su  command to switch to the new user account. For example:

su - sudo-user

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

[sudo] password for sudo-user:

If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.

From here, you should be all set.

Source: digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-ubuntu-quickstart

Was this post helpful?

Leave a Reply

Close Menu