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:
- 4 Methods for How to Install Yarn on Windows Server
- How to Install Bpytop Resource Monitoring Tool on AlmaLinux
- How to Fix “This Site Can’t Provide a Secure Connection” Error
- How to Install MongoDB on AlmaLinux
- How to Install PostgreSQL on AlmaLinux
- How to Use the WP Toolkit to Secure and Update WordPress
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
What Is WebP and What Makes it Different from Other Image Formats?
Read ArticleTop 10 Password Security Standards
Read ArticleTop 10 Password Security Standards
Read ArticleHow to Install MongoDB on AlmaLinux
Read ArticleHow to Use the WP Toolkit to Secure and Update WordPress
Read Article