On Thu, 25 Jan 2007, [EMAIL PROTECTED] wrote: > 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)
[EMAIL PROTECTED] ~]# echo $HOME /root [EMAIL PROTECTED] ~]# su - nagios -sh-3.00$ echo $HOME /var/log/nagios Nope, the environment get changed to the values valid for the user... > so the ssh wants to open ~/.ssh/known_hosts which is /root/.ssh/known_hosts > which is > not readable by the nagios user. sh-3.00$ cd ~/.ssh sh: cd: /var/log/nagios/.ssh: No such file or directory Nope, it looks right into the home directory of 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. Maybe it would help to know which distro you are using - the examples in my mail are from CentOS 4.4. But its the nature of su to behave as it does here: "By default, `su' does not change the current directory. It sets the environment variables `HOME' and `SHELL' from the password entry for USER, and if USER is not the super-user, sets `USER' and `LOGNAME' to USER. By default, the shell is not a login shell." (from the su info page) And my most important point stays: do you really want to have a daemon accessing security related files within roots homedir? 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 Nagios-users@lists.sourceforge.net 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