<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16671"></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Segoe UI">
<DIV>Alexander,</DIV>
<DIV> </DIV>
<DIV>  It sounds like you are saying that you login as root, then su to nagios.  If that's the case, make sure that you use su - nagios</DIV>
<DIV>The hyphen tells su to use the environmental variables of the user that you are switching to.  Without using the hyphen, it continues to use the environmental variables of the base user (root in this case).<BR><BR></DIV>
<DIV> </DIV>
<DIV>
<DIV>Jon Adcock</DIV>
<DIV>Network Systems Administrator</DIV>
<DIV>MIS / Systems Team</DIV>
<DIV>Leon County</DIV>
<DIV>(850) 606-5500</DIV>>>> Alexander Haas <alex@geloet.de> 11/24/2010 3:39 PM >>><BR>Hi Nagios users,<BR><BR>this is my first post. I encountered a behavior I am not able to <BR>understand. Well, I guess I did understand it, but I don't know how to <BR>counter it :)<BR><BR>When I write a plug-in for Nagios it is executed as nagios:nagios. Yet <BR>$HOME is set to "/root".<BR><BR>My /etc/password and nagios's home-directory are ok. It works well when <BR>I log in as user nagios and execute the plug-in there.<BR><BR>I did expect to find some attributes for command definitions to set the <BR>home directory, but I could not find any.<BR><BR>I guess the whole thing has to do with su and the way it does (not) <BR>handle the home directory or environment in general.<BR><BR>Currently I work around that behavior using this code:<BR>if [ "$HOME" == "/root" ] && [ "`whoami`" == "nagios" ]<BR>then<BR>     HOME="/usr/local/nagios"<BR>fi<BR><BR>But as you might guess I am not very satisfied.<BR><BR>Thanks in advance,<BR><BR>Alex<BR><BR>------------------------------------------------------------------------------<BR>Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!<BR>Tap into the largest installed PC base & get more eyes on your game by<BR>optimizing for Intel(R) Graphics Technology. Get started today with the<BR>Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.<BR><A href="http://p.sf.net/sfu/intelisp-dev2dev">http://p.sf.net/sfu/intelisp-dev2dev</A><BR>_______________________________________________<BR>Nagios-users mailing list<BR>Nagios-users@lists.sourceforge.net<BR><A href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</A><BR>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. <BR>::: Messages without supporting info will risk being sent to /dev/null<BR></DIV></BODY></HTML>