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.


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.

Leave a Reply