I'm on RHEL 6.8
I have a user "myuser" with sudoer rights and other users with no sudoers rights.
Can I only allow root to do a "su myuser" in local ?
Thank you
I'm on RHEL 6.8
I have a user "myuser" with sudoer rights and other users with no sudoers rights.
Can I only allow root to do a "su myuser" in local ?
Thank you
Well, once you allow a user to become root, short of using SELinux
there's no way to restrict them. Which is why you shouldn't hand out root permissions willy-nilly.
I'd recommend moving away from su
to sudo
.
That being said, you could cook up something with gpasswd
and pam_wheel.so
, but at best it might break scripts and at worst it's a security risk:
Use pam_wheel
in /etc/pam.d/su
.
Quoting man pam_wheel
:
NAME
pam_wheel - Only permit root access to members of group wheel
SYNOPSIS
pam_wheel.so [debug] [deny] [group=name] [root_only] [trust] [use_uid]
[...]
group=name
Instead of checking the wheel or GID 0 groups, use the name group to perform the authentication.
References:
https://askubuntu.com/questions/601682/restrict-su-to-a-group-of-users