-1

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?

0

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
  • you don't need the first line, if you include it, you will have paswordless root access from a regular user – Nulik Feb 12 '18 at 22:14
0

You have to add this line in /etc/pam.d/su before:

auth       [success=ignore default=1] pam_succeed_if.so user = <username you want to su>

then,

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

to restrict access to group

auth            sufficient      pam_succeed_if.so use_uid user ingroup allowedpeople
  • adding this line breaks root access, I can not longer su to root. – Nulik Feb 12 '18 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.