How To Add a User and Grant Root Privileges on Ubuntu 18.04
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 VPS 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.
Preflight
- 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 above 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 will add in your new user with the same format for us to grant admin privileges.
tom ALL=(ALL:ALL)ALL
Once you’ve added the permission, save and exit the file by using the following process. (In Ubuntu 18.04, nano is the default editor, so we need to use the ctrl+x, y keystrokes to save and exit the file.)
hold `ctrl` and press `x`. At the prompt, press `y` and then hit `enter` to save and exit the file.
Step 3: Verify User Has Privileges
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. We offer assisted migrations and 24/7 support making it effortless to switch to Liquid Web!
Related Articles:

About the Author: Justin Palmer
Justin Palmer is a professional application developer with Liquid Web
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
2024 cPanel and Plesk pricing breakdown
Read ArticleCentOS Linux 7 EOL — everything you need to know
Read ArticleHow to install Node.js on Linux (AlmaLinux)
Read ArticleUpgrading or installing PHP on Ubuntu — PHP 7.2 and Ubuntu 22.04
Read ArticleWhy is your IP blocked?
Read Article