Ubuntu – su without password with pam su-authentication

14.04authenticationpampasswordsu

I've done the following configuration in ubuntu 14.04 but it's still asking password.

$ /etc/passwd

test:x:1004:1004::/home/test:/bin/bash

$/etc/pam.d/su

 auth       required   pam_wheel.so group=test
 auth       sufficient pam_wheel.so trust use_uid

Is there any other method to do this?

Best Answer

su to root without a password

In the file /etc/pam.d/su put this as the line:

auth            sufficient      pam_permit.so

To restrict this just to your username, use this line instead, replace the yourusername with your actual username:

auth            sufficient      pam_succeed_if.so use_uid user = yourusername

You can also restrict this to a group, here the group allowedpeople can su without a password:

auth            sufficient      pam_succeed_if.so use_uid user ingroup allowedpeople

then login

su yourusername
Related Question