0

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.

2
  • Just to clarify you have sudo enabled in nrpe as the command prefix? Dec 30, 2011 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. Dec 30, 2011 at 21:27

5 Answers 5

1

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

1
  • Possibly.. I'll need to look into that. Dec 31, 2011 at 14:39
1

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.

0

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

0

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)

0

The bug is still there. Another fast solution is to put the variable before the command definition in the nrpe.cfg configuration file:

command[check_something]=HOME=/home/user /home/user/script.sh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .