X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Message-ID: <47B621B6.7BDECBCB@dessent.net>
Date: Fri, 15 Feb 2008 15:35:18 -0800
From: Brian Dessent <brian@dessent.net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Windows System Variable with SSH
References: <15507603.post@talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

dnbphysicist wrote:

> We have an open ssh client installed on one of our Windows 2003 servers, and
> are able to login in and everything, but when issuing commands some the
> System Paths (which are in .bat files on the server) such as %JAVA_HOME% are
> not recognized. I assume this is because Cygwin does not know how to

If you're executing a batch file, then Cygwin is not involved at all
becaue CMD.EXE parses and executes batch files.  So that's not the
problem.

> interpret the % signs. Is there anyway to get Cygwin to recognize the system
> variables with the % signs around them.

The problem is that the ssh daemon starts with a clean (empty)
environment when setting up the session and only allows a certain
hardcoded list of allowed variables to be inherited.  See
<http://cygwin.com/ml/cygwin/2006-11/msg00397.html>.  This is a security
feature, so that it's impossible to accidently leak a variable from the
root session that started the daemon to the client session.

You should eliminate the batch file from the equation just to simpify
things; just ssh in and look at what environment variables are set, and
I think you will find that JAVA_HOME is simply not set.  If you want it
to be set, you need to set it explicitly in the shell startup files
(/etc/profile, ~/.bash_profile, ~/.profile, etc.) as you would on *nix,
rather than letting it be inherited from the parent process or set by
the system.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

