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?

1 Answer 1


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).

  • 2
    To edit your sudoers file make sure you run visudo. Don't edit the file directly. Commented Feb 24, 2010 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
    Commented Feb 25, 2010 at 4:39
  • mdpc - thanks for pointing out my deliberate typo...:)
    – Jon
    Commented Feb 25, 2010 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .