Daniel,

nagios is started in /etc/init.d/nagios with "su - nagios -c nagios", so the process inherits the environment varialbes of the root user, which executes the su command. ($HOME is /root)
so the ssh wants to open ~/.ssh/known_hosts which is /root/.ssh/known_hosts which is not readable by the nagios user.

If you look into /etc/init.d/nagios a lot of environment varialbes are set, it is no big deal to set in addition the $HOME variable.

Thorsten

An: [EMAIL PROTECTED]
Von: Daniel Meyer <[EMAIL PROTECTED]>
Datum: 25.01.2007 02:54PM
Kopie: [email protected]
Thema: Re: [Nagios-users] $HOME is not set in init script

On Thu, 25 Jan 2007, [EMAIL PROTECTED] wrote:

> I was writing an event-handler which does ssh to the faulty box. It does not work at
> all, since $HOME was /root and not /var/log. ssh aborted since it could not read
> /root/.ssh/known_hosts.
>
> So please change the /etc/init.d/nagios which sets all environment variable.

Well, its not the init script, its /etc/passwd...

nagios:x:100:101:nagios:/var/log/nagios:/bin/sh

But why should the nagios user be able to read files within roots home
directory? Let the nagios user use its own .ssh/known_hosts file...

Danny
--
Q: Gentoo is too hard to install      =        http://www.cyberdelia.de
   and I feel like whining.           =             [EMAIL PROTECTED]
A: Please see /dev/null.              =
      (from the gentoo installer FAQ) =                             \o/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nagios-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to