Basically, I'm running a Mac Mini as a server, and I'm trying to close some security holes. My server has 3 users: admin, git, and server. Each user has public key authentication enabled, while only git has password authentication enabled. However, once a user is logged in as any account, they can use su to log in as other users with password authentication.
What I'd like to do is disable the su command for users logged via ssh as git or server, so that a potential black hat cannot access the other users' files by logging in as them with a password. If this cannot be done specifically for ssh connections, disabling the command for those two accounts altogether would be fine. However, I do want to be able to use su as admin, so disabling the command altogether is not an option.
I basically want the ONLY way you could access admin via ssh to be with a valid public key only collected from sysadmins, and disable access for users who have keys for git or server and then the user password for admin.
Is this at all possible? How would I go about doing it?