How to give root privileges to a user

15 October 2015, Thursday 0 Comments

1. Add a new user (optional)

At the begining, lets add a new user. We will connect our server with this user.

sudo adduser <username>

We should set a password to our new user. While setting a new password; the caracters that are pressed are now shown in the screen while setting a new password. But don't worry. It will work. Just enter your password and hit return. Then re-type your password and hit return again. That's it.

sudo passwd <username>

2. Add user to root privileges users

To give root privileges to users, we should modify sudoers file and append our new user.

sudo nano /etc/sudoers

Just after open this file, find the root    ALL=(ALL)   ALL line and put indicator to the next line. Write your new users just like the line above. This should looks like this:

root    ALL=(ALL)   ALL
<username>    ALL=(ALL)   ALL

From now on, you can connect to your server via SSH without .pem file. To grant root privileges, write "sudo su".

Share this