How to sudo as another user, without specifying the username

Posted by Pedro on Server Fault See other posts from Server Fault or by Pedro
Published on 2012-06-21T20:54:05Z Indexed on 2012/06/21 21:17 UTC
Read the original article Hit count: 355

Filed under:
|

So I'm currently trying to create a sudoers file, but I ran into something I can't figure out.

The end result I'm looking for is that I want users to be able to do something like:

sudo /usr/sbin/script.pl

But, instead of running as root, I'd like the script to run as "other_user".

I looked into the sudoers file, and I tried adding a line like:

pedro      ALL = (other_user) /usr/sbin/script.pl

But that only works if I specify the user by doing sudo -u other_user /usr/sbin/script.

Is there an (easy) way to have the script run as a specific user, without having to specify it in the command line?

© Server Fault or respective owner

Related posts about sudo

Related posts about sudoers