Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|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

5 Answers 5

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

share|improve this answer
    
Possibly.. I'll need to look into that. –  Tim Brigham Dec 31 '11 at 14:39
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.

share|improve this answer

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

share|improve this answer

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)

share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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