Why This Matters
su also lets accounts run commands as other accounts, including root. We want to make sure that only the accounts we want can use su.
While sudo is more commonly used, su provides another path to root access that should be secured.
Configuration
Add authorized users to the group
Add each account that needs su privileges:You’ll need to do this for every account on your server that needs su privileges.
Verification
To verify the permissions were set correctly:The
s in the permissions indicates the setuid bit is set, allowing the binary to run with the owner’s (root’s) privileges when executed by authorized group members.What This Does
By restricting access to thesu binary:
- Only users in the
suusersgroup can executesu - Unauthorized users will get a “Permission denied” error
- You maintain granular control over who can switch users
- This complements your sudo restrictions for defense in depth