public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Missing environment variables when ssh'ing into Windows machine
@ 2020-01-03  6:59 cygwin
  2020-01-03 15:45 ` cygwin
  0 siblings, 1 reply; 3+ messages in thread
From: cygwin @ 2020-01-03  6:59 UTC (permalink / raw)
  To: cygwin


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?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Missing environment variables when ssh'ing into Windows machine
  2020-01-03  6:59 Missing environment variables when ssh'ing into Windows machine cygwin
@ 2020-01-03 15:45 ` cygwin
  2020-01-06  1:54   ` UPDATE " cygwin
  0 siblings, 1 reply; 3+ messages in thread
From: cygwin @ 2020-01-03 15:45 UTC (permalink / raw)
  To: cygwin; +Cc: cygwin

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.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* UPDATE Re: Missing environment variables when ssh'ing into Windows machine
  2020-01-03 15:45 ` cygwin
@ 2020-01-06  1:54   ` cygwin
  0 siblings, 0 replies; 3+ messages in thread
From: cygwin @ 2020-01-06  1:54 UTC (permalink / raw)
  To: cygwin; +Cc: cygwin

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-06  1:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03  6:59 Missing environment variables when ssh'ing into Windows machine cygwin
2020-01-03 15:45 ` cygwin
2020-01-06  1:54   ` UPDATE " cygwin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).