How To Add a User and Grant Root Privileges on Ubuntu 18.04

Reading Time: 2 minutes

Adding a user and granting that user root privileges is one of the many tasks of a system admin.   Once a user has been added and granted root privileges they’ll be able to login to your Ubuntu 18.04 and perform vital functions for the upkeep of the system. Afterward, they’ll be able to use sudo before commands to perform elevated tasks.  In this quick tutorial, we’ll show you how to add a new user and grant root permissions.

Pre flight

  • These instructions are intended specifically for adding a user on Ubuntu 18.04 LTS.
  • We’ll be working from a Liquid Web Core Managed Ubuntu 18.04 LTS server, and I’ll be logged in as root.

Step 1: Add the Username

In my example, I’ll be adding my cat’s name, Tom, using the adduser command. Replace tom with your desired username. During this time, the system will also ask of me details from my user.  Feel free to skip these details by pressing enter and eventually it asks us to confirm that the info is correct, leading us to a new user added.

adduser tom

Example Output:
Adding user `tom' ...
Adding new group `tom' (1001) ...
Adding new user `tom' (1001) with group `tom' ...
Creating home directory `/home/tom' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for tom
Enter the new value, or press ENTER for the default
Full Name []: Tom
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y

Step 2: Grant Root Privileges to the User

visudo

The command below leads us to the /etc/sudoers.tmp file where we can view the following code:# User privilege specification
root    ALL=(ALL:ALL) ALL

After the root user line, you’ll add in your new user with the same format for us to grant admin privledges.

tom ALL=(ALL:ALL)ALL

Once you’ve added the permission, save and exit the file by using :wq and enter.

Step 3: Verify User Has Privledges

If you’ve followed the instructions correctly then this user will be able to run commands like, update, using the sudo:

su - tom

sudo apt-get update

Want to do admin tasks through a control panel? Check out our servers that come with cPanel servers.  We offer free migrations and 24/7 support making it effortless to switch to Liquid Web!

Author Bio

About the Author: Echo Diaz

Throughout Echo's four year stint as a technical support specialist, her passion for breaking down complex concepts has to lead to a career in professional writing. As a top tier support specialist, she adds a distinctive element to her written work that speaks to customer feedback and concerns.

Echo occasionally pops her head out from behind her computer to watch her dog energetically run around the yard and unabashedly shovels money into buying tickets to see her favorite musical artists.

Refer a friend and receive hosting credit