Disable su on machine

susudo

Is there a way to allow su only for specified users (like using visudo for sudo).

The reason for this is I'd like to keep a simple (weak) password for my root account and have accounts that can su/sudo only be able to login to the machine using a pub/private key.

Then, all other accounts would not be able to su as root or as an account that can su.

Best Answer

Yep, the 'wheel' group trick is also available on linux: you just need to configure pam for it and then, only wheel members can run su.

On Debian, you have to uncomment the wheel line of /etc/pam.d/su

This is definitely the first thing to do on any server, or else, any webserver/ hacked can lead to a root hack.