delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/01/05/20:55:08

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=KZ9f5LDARXvmet
Rt3NoflDg91vYEj7Ro9vv5lQfy4p/Jxl2WrMdmjV0grfw8vh0RWwLOJGjeBidXbF
fdJReN4ZiueWyWqnXUmNgQynCqipm/CFfrTUJr68y4iW6pV/TwU0UnrbvznY8RLL
JcxdkPpQk/p0UlV5mLWCYjzMQWs0g=
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=carj9rz9UNT24l0kYw2S
6digtxM=; b=em0KmtTBQXWi3b8zI6ir1cAwAnGXT06K+wRC/afgbOopaZM9nKRh
uL2zw3ws+cyZStKlyIfeSvNtVEvJIsZyLjPke048/ZR3xit9Yw5MIsEvA3gIDTLL
WO5z/t98wQavmd2yZ35A46c+xaT4VVJEYABjoIAAcI+yWGoTWiXEjPw=
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, older, tampering, sshd
X-HELO: p3plsmtpa12-09.prod.phx3.secureserver.net
X-Sender: inbox AT kosowsky DOT org
MIME-Version: 1.0
Message-ID: <24082.37699.186754.637987@consult.pretender>
Date: Sun, 5 Jan 2020 20:54:11 -0500
To: cygwin AT kosowsky DOT org
Cc: cygwin AT cygwin DOT com
Subject: UPDATE Re: Missing environment variables when ssh'ing into Windows machine
In-Reply-To: <24079.25007.477247.455762@consult.pretender>
References: <24078 DOT 58951 DOT 690280 DOT 502600 AT consult DOT pretender> <24079 DOT 25007 DOT 477247 DOT 455762 AT consult DOT pretender>
From: cygwin AT kosowsky DOT org
X-IsSubscribed: yes

cygwin AT kosowsky DOT org wrote at about 10:45:51 -0500 on Friday, January 3, 2020:
 > 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.
 > 

I verified that the difference is solely related to whether sshd is
started directly by calling /usr/bin/sshd or by starting the service
via 'cygrunsrv -S sshd' -- the former doesn't set the environment
variables, while the latter does!
Even if both are run with admin privileges!

Really wish I knew what 'cygrunsrv' does differently...

--
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