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.

Tim Brigham
  • 15,545
  • 10
  • 75
  • 115

5 Answers5

1

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

devicenull
  • 5,622
  • 1
  • 26
  • 31
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.

Tim Brigham
  • 15,545
  • 10
  • 75
  • 115
0

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

Dennis Wisnia
  • 259
  • 2
  • 12
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)

Keith
  • 4,637
  • 15
  • 25
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
dseira
  • 1
  • 3