Monday 10 June 2013

Give root previlages to a user

Below are the steps to give root previlages to a user
Method 1:
1:Open run /etc/sudoers file
vi /etc/sudoers
 

2:Search  below line and add entry for testuser user
root   ALL=(ALL)       ALL
testuser   ALL=(ALL)       ALL

Now you can run any command from testuser user like :
sudo useradd test

Method 2:
1: open /etc/passwd file and search that user to whom you want to give root previlages , for me it is "user1"
2: edit entries as below :
old was :
user1:x:505:505::/home/user1:/bin/bash
new is :
user1:x:0:0::/home/user1:/bin/bash

Now you can login using yuvraj.singh and you will be logged in as root user.
This method will not work if root login is disabled.

No comments:

Post a Comment