Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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).

share|improve this answer
To edit your sudoers file make sure you run visudo. Don't edit the file directly. – 3dinfluence Feb 24 '10 at 22:26
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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