Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 am trying to figure this out, but have not found a proper answer to this yet:

Is it possible to add a user to /etc/sudoers only with the rights to use sudo -u for specific users?

share|improve this question
it's not clear to me: do you mean to limit the target users? E.g. permit say jsmith to run sudo -u jbloggs foo and sudo -u jdoe foo but not sudo -u jchin foo – Norky Jul 29 '11 at 9:57
up vote 3 down vote accepted

Yes you can specify the users in the sudoers file

To let youruser run any command as the user specificuser do this:

youruser      ALL = (specificuser)    ALL
share|improve this answer

From the man sudoers page:

A Runas_Spec sets the default for the commands that follow it. What this means is that for the entry:

    dgb    boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm

The user dgb may run /bin/ls, /bin/kill, and /usr/bin/lprm -- but only as operator. E.g.,

    $ sudo -u operator /bin/ls.

I'm running sudo-1.7.4p5-4.fc15.x86_64

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.