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?


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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