How to give Root Privileges to a User on a Linux Server

For security reason it is recommended that you disable root SSH login to server. To SSH your server with root privileges you should create a new user and assign root privileges to this new user.

In this tutorial, we will assign root privileges to a new user ravi on a CentOS server.

Step 1:

Create a new user on your server whom you want to grant root privileges. Please refer to below tutorial how to create a new user on a Linux Server.
How to create a User on a CentOS Server from SSH

Step 2:

Let us assume that you have create a new user named ravi and you want to assign root privileges to user ravi.
Open /etc/sudoers in any text editor.

nano /etc/sudoers

Find following code

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

Below the details of root’s privileges line, add the following line.

ravi    ALL=(ALL)       ALL

This will grant all permissions to user ravi.
Done!!

Our Top Rated Host

Related Posts