Saturday, August 18, 2012

How to SU with no password in FreeBSD

You can allow user to switch to root account without password. You need to add user to wheel group:
pw usermod john -G wheel
and change pam policy (file /etc/pam.d/su):
#auth            requisite       pam_group.so            no_warn group=wheel root_only fail_safe ruser
auth            sufficient      pam_group.so            no_warn group=wheel root_only fail_safe ruser
It is necessary to re-login so new group membership take place. Issue the following command to check user group:
$ id
uid=1001(john) gid=1001(john) groups=1001(john),0(wheel)

1 comment :

  1. everywhere is written that simply add users to the wheel group. Yes, but when you switch users using su command is necessary to enter the root password. And I dont want to tell other people root password!

    An adjustment file /etc/pam.d/su mentions not much!

    Solved, thank you!

    ReplyDelete