delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/01/03/10:46:48

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:message-id:date:to:cc:subject
:in-reply-to:references:from; q=dns; s=default; b=bTPkasQYk4rU8P
UHtbFGLpxIBMht8SQnmGf7ezORPRx1hOD7trY/Y4p+B6CGRsidmYhLYgAdMK2PbA
9pwXTFVZxiU3Qi+wBn7APhjnwNP7RP4m6WhjQPpf/apXX7F1anQF/VJEG2aI8AJ8
9AHJ9lV8+1emo2EevDRhdsGeM340g=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:message-id:date:to:cc:subject
:in-reply-to:references:from; s=default; bh=dUP9Uu318mCQoWY4MlFw
rSjrJEE=; b=KlhkQetK0OqwnHbvyntn4UtuNFSD0w5VYU0NDL7HsuLODGoeP5qY
b/MUwNS1ECrLiBvRWYNw/xPzDU8qpuOlP/yfcmInTGzaptkGVkW/79kExBZcDhYj
7ECCek3OghWpH8Yk5Dwkt9wacGjM/BnnVur6MRPEMUVLwokWxoQFk9o=
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
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=attendant, exporting, H*f:sk:24078.5, cygwinkosowskyorg
X-HELO: p3plsmtpa07-03.prod.phx3.secureserver.net
X-Sender: inbox AT kosowsky DOT org
MIME-Version: 1.0
Message-ID: <24079.25007.477247.455762@consult.pretender>
Date: Fri, 3 Jan 2020 10:45:51 -0500
To: cygwin AT kosowsky DOT org
Cc: cygwin AT cygwin DOT com
Subject: Re: Missing environment variables when ssh'ing into Windows machine
In-Reply-To: <24078.58951.690280.502600@consult.pretender>
References: <24078 DOT 58951 DOT 690280 DOT 502600 AT consult DOT pretender>
From: cygwin AT kosowsky DOT org
X-IsSubscribed: yes

cygwin AT kosowsky DOT org wrote at about 01:59:19 -0500 on Friday, January 3, 2020:
 > 
 > The Windows variables $USERNAME, $USERPROFILE and $USERDOMAIN are set properly
 > when opening a cygwin bash shell on a Windows 10 machine.  
 > 
 > However when I *ssh* into that same machine (under the same user name),
 > the variables are unset in the bash shell.
 > 
 > More generally, it seems that none of my Windows User variables are
 > set under a remote ssh bash shell while they are all inherited properly
 > when opening a cygwin bash shell directly on the machine.
 > 
 > I have not had that problem in the past on my other (older) Windows
 > machine
 > The only differences that come to mind are:
 > 1. The other machine is Win7 and not Win10
 > 2. On this (Win10) machine I installed cygwin as a non-admin while the
 >    Win7 machine was installed with admin privileges
 > 3. Because of #2, I start ssh on the Win 10 machine by running
 >    /usr/sbin/sshd manually as a user, while on Win 7, I am able to
 >    start sshd as a service, running as SYSTEM
 > 4. This (Win10) machine doesn't have an /etc/passwd file whereas the
 >    Win7 machine does.
 > 
 > I am assuming that #3 may be the source of the problem...
 > 
 > Still seems strange that these seemingly very basic Windows variables
 > are not available under ssh.
 > 
 > Any way to fix this?
 > 

Said another way,  assuming that the issue is my non-admin Cygwin
install and my attendant need to run 'sshd' manually rather than as
service, what can I do to best 'fake' running 'sshd' as a service that
will allow it to load the environment variables automatically.

For 'cleanliness' and 'consistency' purposes, I would like to do that
as a wrapper around the call to 'sshd' rather than by tampering with
/etc/sshd_config and /etc/sshd_config or by manually recreating and exporting the
Windows variables in .bashrc or .bash_profile. In other words, I want
to keep my standard installation configuration as clean and unchanged
as possible.

Thanks,
Jeff

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

- Raw text -


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