delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/02/15/18:36:05

X-Recipient: archive-cygwin AT delorie DOT 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 AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Windows System Variable with SSH
References: <15507603 DOT post AT talk DOT nabble DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019