From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59776 invoked by alias); 6 Jan 2020 01:54:17 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 59767 invoked by uid 89); 6 Jan 2020 01:54:17 -0000 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 Received: from p3plsmtpa12-09.prod.phx3.secureserver.net (HELO p3plsmtpa12-09.prod.phx3.secureserver.net) (68.178.252.238) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Jan 2020 01:54:15 +0000 Received: from consult.pretender ([146.115.147.63]) by :SMTPAUTH: with ESMTPSA id oHauioUjdLD12oHaviCexe; Sun, 05 Jan 2020 18:54:13 -0700 X-Sender: inbox@kosowsky.org Received: from consult.pretender (localhost [127.0.0.1]) by consult.pretender (Postfix) with ESMTP id C8E5B1215786 for ; Sun, 5 Jan 2020 20:54:11 -0500 (EST) Received: by consult.pretender (Postfix, from userid 495) id C754E1215785; Sun, 5 Jan 2020 20:54:11 -0500 (EST) Received: from consult.pretender (localhost [127.0.0.1]) by consult.pretender (Postfix) with ESMTPSA id 340CA1215773; Sun, 5 Jan 2020 20:54:11 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <24082.37699.186754.637987@consult.pretender> Date: Mon, 06 Jan 2020 01:54:00 -0000 To: cygwin@kosowsky.org Cc: cygwin@cygwin.com Subject: UPDATE Re: Missing environment variables when ssh'ing into Windows machine In-Reply-To: <24079.25007.477247.455762@consult.pretender> References: <24078.58951.690280.502600@consult.pretender> <24079.25007.477247.455762@consult.pretender> From: cygwin@kosowsky.org X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00044.txt.bz2 cygwin@kosowsky.org wrote at about 10:45:51 -0500 on Friday, January 3, 2020: > cygwin@kosowsky.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