check_by_ssh vs. ssh (when executed, have different environments)

Marc Powell marc at ena.com
Wed Oct 11 23:58:40 CEST 2006



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Bret Goodfellow
> Sent: Wednesday, October 11, 2006 4:14 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] check_by_ssh vs. ssh (when executed,have
different
> environments)
> 
> The user (nagios) is the id that is executing both ssh and
check_by_ssh.
> When these commands are run, the "environments" established for ssh
and
> check_by_ssh are different (why)?
> 
> Below is the environment established for ssh:
> 
> SHELL=/bin/bash
> SSH_CLIENT=10.8.24.170 58641 22
> USER=nagios
> LS_COLORS=
> ORACLE_SID=ver_9206
> ORACLE_BASE=/oracle
> ORACLE_ADHOC=/oracle/local/adhoc
> MAIL=/var/mail/nagios
> PATH=/usr/bin:/bin:/usr/sbin:/sbin
> TNS_ADMIN=/oracle/network/admin
> PWD=/home/nagios
> LANG=en_US.UTF-8
> SQLPATH=/oracle/local/adhoc:%PATH
> SHLVL=1
> HOME=/home/nagios
> LS_OPTIONS=-N --color=non -T O
> LOGNAME=nagios
> SSH_CONNECTION=10.8.24.170 58641 10.8.24.191 22
> ORACLE_HOME=/oracle/product/9.2.0.6
> _=/usr/bin/env
> 
> And, here is the environment when running the command, check_by_ssh:
> 
> SHELL=/bin/bash
> SSH_CLIENT=10.8.24.170 58641 22
> USER=nagios
> LS_COLORS=
> MAIL=/var/mail/nagios
> PATH=/usr/bin:/bin:/usr/sbin:/sbin
> PWD=/home/nagios
> SHLVL=1
> HOME=/home/nagios
> LS_OPTIONS=-N --color=non -T O
> LOGNAME=nagios
> SSH_CONNECTION=10.8.24.170 58641 10.8.24.191 22
> _=/usr/bin/env
> 
> I'm running both commands from the same server as user, nagios.  It
> appears that check_by_ssh changes my env settings (notice that there
are
> no ORACLE environments specified).  Does check_by_ssh not use the
> /etc/ssh/config settings?  Where is this done?  I would almost believe
> that check_by_ssh bypasses the default ssh settings for sending env
> variables.

check_by_ssh does not initiate a full login shell when executing
commands. In fact, it is a simple but intelligent wrapper for 'ssh
user at host somecommand' so as such, the ssh command on the remote host is
going to see only the environment variables available for a non-login
process and those that ssh specifically sets. 'man ssh' and search for
'ENVIRONMENT'. That section of the man page will detail the limited
number of environment variables that ssh will set on it's own and how to
add others via $HOME/.ssh/environment. check_by_ssh doesn't modify or
limit the remote environment in any way. 

--
Marc 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at 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





More information about the Users mailing list