Showing posts with label Grant root privilege for a normal user in Linux.. Show all posts
Showing posts with label Grant root privilege for a normal user in Linux.. Show all posts

Friday, 4 May 2012

Wheel user to become as root (su -) without password

1. Create a user:

useradd test
passwd test

2. Add this user in wheel group.

usermod -a -G wheel test

3. Now, Edit PAM configuration file for su. (/etc/pam.d/su)

----
 vi /etc/pam.d/su

uncomment below line
auth sufficient /lib/security/$ISA/pam_wheel.so trust use_uid

This will allow users in wheel group as a trusted users.
-----

4. Login as test user.
 #su -
It will not ask for password.

OR

If we add the test user in "visudo", we need to use "sudo su -" to become root without password.
----
1. visudo or vi /etc/sudo
2.  Add the below line 
   test    ALL=(ALL)   NOPASSWD:ALL
3. Save and exit
----

It will also grant root privilege for the user "test", but we need to use "sudo su -" to became as a root.