Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using ubuntu server 12.04 LTS

I want to know how to configure my sudoers file (obviously, using visudo), to permit an user to run commands like root (doing something like "sudo service x restart") but without the permission to be root (doing "sudo su").

In the sudoers file, we have the follow lines:

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

I've tried to put my user in both of the groups, but in both of they, the user can being root doing "sudo su".

Any tips on how to configure the sudoers file to make my webserver really secure when using the terminal with users that can run root commands?

share|improve this question

migrated from stackoverflow.com Apr 15 '13 at 11:21

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

In that case you will need to provide an explicit list of things that would be OK to run.

%sudo   ALL=(ALL:ALL) /usr/sbin/service * restart, /path/to/command options, ... 
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .