I'm using NRPE and I a rather annoying problem. I need a couple temporary files written to the home directory of the user NRPE is running under (nagios).

I checked that the /etc/passwd entry for Nagios is correctly pointing to /home/nagios and that NRPE is set to execute under the Nagios user. The service reliably is trying to write to my user's folder (when restarting the service with sudo) or to / (when rebooting).

The official documentation doesn't have anything on this subject. How can I make this happen?

EDIT - this only occurs from items executed via NRPE. It is not a permissions issue.

Adding a small script that sets the HOME variable and then calls the intended executable does get around the issue but that is an ugly and non scalable solution.

link|improve this question

Just to clarify you have sudo enabled in nrpe as the command prefix? – jeffatrackaid Dec 30 '11 at 20:11
No - there is no need. This command should be executing under the context of the nagios user. This worked perfectly until recently. – Tim Brigham Dec 30 '11 at 21:27
feedback

4 Answers

Did SELinux or a similar security program recently get added? I could easily see this denying write access for NRPE.

link|improve this answer
Possibly.. I'll need to look into that. – Tim Brigham Dec 31 '11 at 14:39
feedback
up vote 1 down vote accepted

It appears to be a bug in the version of NRPE I'm using. As a workaround I'm setting the HOME variable with a shell script where necessary.

link|improve this answer
feedback

I'd looks like an permission problem and you can try an sudo su - nagios and an touch ~/test

link|improve this answer
feedback

As you have discovered, nagios/nrpe doesn't have $HOME when running scripts. In fact, it doesn't have any ENV at all.

You need to use full paths in any checks/script that NRPE runs, or explicitly set $HOME in the script. (Or just always use /tmp)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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