I have a situation where I want the main admin user (with sudo for all) to have passwordless sudo as another user for one command. To my knowledge, that should give the following in /etc/sudoers:
ramo ALL=(otherUser) NOPASSWD: /usr/bin/command
ramo ALL=(ALL) ALL
But it seems like those two lines conflict, or the second overwrites the first. Any ideas on how to accomplish this?
Cheers
Ramo
EDIT: Turns out I slightly misunderstood how sudo works when specifying a user. I was under the impression that if you have ALL=(otherUser) then you didn't need to 'sudo -u otherUser' but could just sudo. This isn't the case.
Best Answer
The order is important and the behaviour is described in the sudoers(5) man page:
With your original rules, the "(ALL) ALL" is the last match and so sudo prompts for the password.
The following /etc/sudoers works:
e.g.:
Tested on Fedora 19 with sudo-1.8.6p7-1