The sshd server normally builds the environment variables from scratch for a shell process it creates. Except when compile for Cygwin, it simply adds settings to its own set of environment variable settings. A comment in the code says this special case is made because in Cygwin, some of sshd's environment is important for child processes too. I don't run Cygwin (I run Linux), but on my system too, it is important that environment variable settings get inherited by all the processes. In fact, in normal operation on my system, all the environment variables that sshd inherits are also relevant to every shell it spawns. Could preserving the environment be an option in sshd.config? -- Bryan Henderson Phone 408-621-2000 San Jose, California
I'm not sure why this should be important to you. All critical variables should be in your /etc/profile or your csh/tcsh equiv. Cygwin is an acception to the rule since it is really just a collection of UNIX utils and not a full fledge OS. - Ben On Mon, 23 Dec 2002, Bryan Henderson wrote:> The sshd server normally builds the environment variables from scratch > for a shell process it creates. Except when compile for Cygwin, it > simply adds settings to its own set of environment variable settings. > A comment in the code says this special case is made because in > Cygwin, some of sshd's environment is important for child processes > too. > > I don't run Cygwin (I run Linux), but on my system too, it is > important that environment variable settings get inherited by all the > processes. In fact, in normal operation on my system, all the > environment variables that sshd inherits are also relevant to every > shell it spawns. > > Could preserving the environment be an option in sshd.config? > > -- > Bryan Henderson Phone 408-621-2000 > San Jose, California > _______________________________________________ > openssh-unix-dev at mindrot.org mailing list > http://www.mindrot.org/mailman/listinfo/openssh-unix-dev >
This was mysteriously bounced from the list when I sent it last week, so here's another try. The context is that I am suggesting that there be an option to allow shells spawned by sshd to inherit the environment of the sshd process. Today, Sshd does this for the special case of Cygwin, but starts the environment fresh on every other platform.>All critical variables should be in your /etc/profile or your csh/tcsh >equiv.I disagree. I know that is traditionally where these variables are set, but it isn't the logical place to do it, which is why I don't have my system set up that way. /etc/profile and other shell profiles are the appropriate place to set variables that pertain to the (interactive) use of that shell. But some environment variable settings apply to any program running anywhere, under any shell or not involving a shell at all. Some variables could conceivably be necessary in order to start up the shell and run its profile. Going back to when the traditional roles of Init, login programs, shells, shell profiles, and such were invented, the parameters of system-wide scope were compiled in to every program installed on the system. That's still true of most of them. But the modern trend is toward more binary portability, and I follow that. I prefer, for example, not to have any file paths compiled into programs I run. I use the environment variables they provide to give path information. So I maintain environment variables. Init sets them via initscript in every process it spawns. A few are even set via kernel boot parameters and inherited by all of Init's progeny. Traditional logins work fine because I use the -p option on Login ("preserve environment"). Ssh via Openssh defeats the plan, though. Openssh would have me set those environment variables one place for every process _except_ shells spawned by sshd, but in each shell profile for shells spawned by sshd. My particular system, of course, is not the issue. I'll run the sshd that works for me. The issue is that there is more logic in retaining the environment than in discarding it, and I believe the Cygwin requirement is based in the basic rightness of that, not any fundamental difference between Cygwin and real Unix. -- Bryan Henderson Phone 408-621-2000 San Jose, California
Maybe Matching Threads
- scp not tolerant of extraneous shell messages
- GUI/X11 login and shells other than bash?
- [Bug 273] New: sshd hangs on shell exit if user spawned child with /bin/nohup
- [Bug 273] sshd hangs on shell exit if user spawned child with /bin/nohup
- [Bug 273] sshd hangs on shell exit if user spawned child with/bin/nohup