Don't ask why I'm doing it this way but I have to.

Say I have a user name "bob" and he needs to run a program as "monitor." I want to allow "bob" to sudo into the monitor account and run the process. Obviously I could just give "bob" sudo access to run the app but I'm told it has to run as "monitor." Anyways, how can this be done?

link|improve this question

59% accept rate
feedback

1 Answer

up vote 5 down vote accepted

yup, set your sudoers entry like this:

bob ALL = monitor PASSWD: COMMAND

Bob can then run the COMMAND under sudo and it will run as monitor (you can of course use NOPASSWD: if you want to force a password check).

link|improve this answer
2  
To edit your sudoers file make sure you run visudo. Don't edit the file directly. – 3dinfluence Feb 24 '10 at 22:26
1  
I think that your statement has an error.... PASSWD: does a password check, and NOPASSWD: allows a sudo command to be processed without any password check. – mdpc Feb 25 '10 at 4:39
mdpc - thanks for pointing out my deliberate typo...:) – Jon Feb 25 '10 at 8:34
feedback

Your Answer

 
or
required, but never shown

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