[sudo-users] How to execute command as another user

Todd C. Miller Todd.Miller at courtesan.com
Sun Feb 13 12:48:19 EST 2005


In message <82a71f8a05021114434fdf4647 at mail.gmail.com>
	so spake Doug Hanks (dhanks):

> I was wondering if anyone knew how to setup the /etc/sudoers file to
> allow me to execute a command as someone other than root?
> 
> I want to execute the following command:
> 
> sudo -u oracle /bin/ls
> 
> I want to restrict the use to only be able to execute the above
> command and only as oracle.

You just add the user you want to run things as in parens before
the command, e.g.

username	hostname = (oracle) /bin/ls

 - todd



More information about the sudo-users mailing list