2

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?

  • 1
    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
  • It's clear that this question is about being about to sudo -u someuser and not sudo -u someotheruser or just sudo as root. – Simon Woodside May 31 '16 at 4:15
5

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
| improve this answer | |
3

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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