first of all: I know there were already questions about this issue, but even using their answers I still cannot figure out why my command is not working.
What I want to do is call a script on remote host using NRPE. However, this what the script is going to do may be only executed by specific user: tomcat.
I tried even the least secure solution, just to make it work - with no luck unfortunately.
1. My nrpe.cfg has entry:
Code: Select all
command[debug_now]=/usr/local/bin/debug_nowCode: Select all
#!/bin/sh
whoami
echo "Debug..."
sudo -u tomcat whoami
echo "Debug finished"Code: Select all
Defaults env_reset
Defaults !requiretty
root ALL=(ALL) ALL
(...) a few not relevant users
nagios ALL=(ALL) NOPASSWD: ALL
%tomcat ALL=(ALL) NOPASSWD: /bin/su - tomcat
%tomcat ALL=(ALL) NOPASSWD: /etc/init.d/tomcat stop
%tomcat ALL=(ALL) NOPASSWD: /etc/init.d/tomcat start
%tomcat ALL=(ALL) NOPASSWD: /etc/init.d/tomcat restartCode: Select all
nagios ALL=(tomcat)4.Permissions
Code: Select all
-rwxr-xr-x 1 root staff 582 Dec 2 11:11 /usr/local/bin/debug_now5. Output when run in local shell as nagios
Code: Select all
~$ sudo -u nagios /usr/local/bin/debug_now
nagios
Debug...
tomcat
Debug finished
Code: Select all
~$ /usr/lib/nagios/plugins/check_nrpe -H (... ip here) -c debug_now
nagios
Debug...
Debug finished
I'm pretty sure I covered everything but still something is missing. Could you try to point me out my problem?
EDIT.
If this may be useful - I use Debian 6.0.7, Nagios 3.2.0, NRPE v2.12