Preventing normal users from using the su command

I was asked how to force normal users to use the sudo command and to never allow them use the su command.  The reason given was for auditing purposes.  The sudo command logs “who” and “what”, whereas the su command does not.

Here is one solution to the problem.  Remove the execute permissions for group others.


$ sudo chmod o-x /bin/su

Now create a rule in /etc/sudoers to handle a case where a user, identified by the username thomas, might try to run “sudo su”.


Cmnd_Alias SU = /bin/su

thomas ALL=(ALL) !SU

 

Advertisements

One thought on “Preventing normal users from using the su command

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s