Running nrpe as non-root cannot remove its PIDFILE


#1

When nrpe is run as non-root, it cannot remove its own PIDFILE:

ps auwx | grep nrpe

nagios 89267 0.0 0.4 2568 1752 ?? Ss 9:24PM 0:05.08 /usr/local/sbin/nrpe2 -c /usr/local/etc/nrpe.cfg -d

ls -l /var/run/nrpe2.pid

-rw-r–r-- 1 root wheel 6 Mar 11 21:24 /var/run/nrpe2.pid

Note: nrpe is running as user nagios, but the PIDFILE is chown root:wheel

/usr/local/etc/rc.d/nrpe2 stop

Stopping nrpe2.

tail -3 /var/log/messages

Mar 12 07:59:15 bast su: dan to root on /dev/ttyp0
Mar 12 07:59:56 bast popper[5732]: Stats: dan 0 0 0 0 wocker.unixathome.org 10.55.0.99
Mar 12 07:59:56 bast popper[5733]: Stats: dan 0 0 0 0 wocker.unixathome.org 10.55.0.99
Mar 12 08:00:57 bast popper[5780]: Stats: dan 3 3765 0 0 wocker.unixathome.org 10.55.0.99
Mar 12 08:00:57 bast popper[5781]: Stats: dan 0 0 0 0 wocker.unixathome.org 10.55.0.99
Mar 12 08:01:58 bast popper[5838]: Stats: dan 1 7134 0 0 wocker.unixathome.org 10.55.0.99
Mar 12 08:01:58 bast popper[5839]: Stats: dan 0 0 0 0 wocker.unixathome.org 10.55.0.99
Mar 12 08:02:00 bast nrpe[89267]: Caught SIGTERM - shutting down…
Mar 12 08:02:00 bast nrpe[89267]: Cannot remove pidfile ‘/var/run/nrpe2.pid’ - check your privileges.
Mar 12 08:02:00 bast nrpe[89267]: Daemon shutdown