1827482 Members
2167 Online
109965 Solutions
New Discussion

sudo help

 
Steve_3
Frequent Advisor

sudo help

How can I get this to work...

sudo su - user -c "command"

Thanks,
Steve

3 REPLIES 3
Jose Mosquera
Honored Contributor

Re: sudo help

Hi,

-u Option

The -u (user) option causes sudo to run the specified command as a user other than root. To specify a uid instead of a username, use #uid.

#sudo -u

Pls check this on-line manual link:
http://www.courtesan.com/sudo/man/sudo.html

Rgds.
Steve_3
Frequent Advisor

Re: sudo help

Yeah. The -u option is not going to work. B/c I have a command executing another command.
Colin Topliss
Esteemed Contributor

Re: sudo help

How about this in your sudoers file?

usera systema = (userb) /home/userb/myscript

So, usera on systema can run userb's myscript as userb.

You can also override the Runas_Spec:

usera systema = (userb) /home/userb/myscript, (userc) /home/userc/myscript

So, usera on systema can run userb's myscript as userb, and userc's myscript as userc.

Hope that makes sense. If not, have alook at more examples on the sudoers man page.

Col.