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.
- 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.
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 :
Is the information correct? [Y/n] Y
Step 2: Grant Root Privileges to the User
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.
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.)
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 servers. We offer free migrations and 24/7 support making it effortless to switch to Liquid Web!
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.