public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: openSSH under cygwin fix
@ 2001-04-25  7:20 Karl M
  0 siblings, 0 replies; 7+ messages in thread
From: Karl M @ 2001-04-25  7:20 UTC (permalink / raw)
  To: cygwin

Hi Corinna...

But when the process is spawned, it has the environment of SYSTEM or the 
user running the sshd daemon instead of the target user. Is it possible to 
change that?

For now, I just set the ~/.ssh/environment to fix things up. But that 
requires maintaining two copies of my environment definitions...one for 
win2k and one for sshd.

Thanks,

...Karl


>From: Corinna Vinschen <cygwin@cygwin.com>
>To: cygwin@sources.redhat.com
>Subject: Re: openSSH under cygwin fix
>Date: Wed, 25 Apr 2001 15:08:13 +0200
>
>On Wed, Apr 25, 2001 at 01:41:19PM +0100, Gaz Jones wrote:
> > Hi, first, thanks for the great cygwin and for the work on
> > the openSSH port. I _think_ I may have found a problem (I
> > may not have, have only been playing around with the
> > code so far :), in that the PATH under Windows doesn't
> > seem to be getting set after I log in. The relevant
> > lines are in session.c (1205 - 1213):
> >
> > # ifndef HAVE_CYGWIN
> >   /*
> >    * There's no standard path on Windows. The path contains
> >    * important components pointing to the system directories,
> >    * needed for loading shared libraries. So the path better
> >    * remains intact here.
> >    */
> >   child_set_env(&env, &envsize, "PATH", _PATH_STDPATH);
> > # endif /* HAVE_CYGWIN */
> >
> > Changing the # endif line to:
> >
> > #else
> >   child_set_env(&env, &envsize, "PATH", getenv("PATH"));
> > #endif /* HAVE_CYGWIN */
> >
> > fixes this. This could be a result of my setting up a very bare
> > bones cygwin setup (testing to see how little I need to have a
> > running SSH setup) and using cmd.exe as my shell.
>
>I appreciate your effort but I'm surprised that your above
>fix should change anything.  If you examine session.c again,
>you will find a few lines above the following code:
>
>=== SNIP ===
>#ifdef HAVE_CYGWIN
>         /*
>          * The Windows environment contains some setting which are
>          * important for a running system. They must not be dropped.
>          */
>         copy_environment(&env, &envsize);
>#endif
>=== SNAP ===
>
>This code copies the whole environment. Call `ssh -v'. That will
>print the environment which is inherited to the shell. You will
>have to start sshd with -d option, though.
>
> > I also found that when using sftp-server, if you didn't use
> > sh (or a typical UNIX shell I assume), I couldn't sftp to the
> > server - to fix this I added some code that would check for
>
>Yep, that's a cmd problem. Any UNIX shell works.
>
> > an environment variable called NEWSHELL and would use that
> > as the shell if it was specified. Hence, when using sftp I
> > can use sh, but with SSH I can use cmd.exe. I can mail the
> > few extra lines of code for this if you want.
>
>Hmm, I'm not quite sure if the OpenSSH maintainers will like
>that patch. If you really want to get it into the official
>OpenSSH sources I suggest sending the patch to the mailing list
>openssh-unix-dev@mindrot.org. I'm trying to avoid any special
>Cygwin code which is not in the official sources.
>
>Corinna
>
>--
>Corinna Vinschen                  Please, send mails regarding Cygwin to
>Cygwin Developer                                mailto:cygwin@cygwin.com
>Red Hat, Inc.
>
>--
>Want to unsubscribe from this list?
>Check out: http://cygwin.com/ml/#unsubscribe-simple
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

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

* Re: openSSH under cygwin fix
  2001-04-25  8:16 Karl M
@ 2001-04-25 13:58 ` Corinna Vinschen
  0 siblings, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2001-04-25 13:58 UTC (permalink / raw)
  To: cygwin

On Wed, Apr 25, 2001 at 08:15:56AM -0700, Karl M wrote:
> Hi C...
> 
> I understand what you are saying, and agree with that.
> 
> What I am saying is that when I use sshd running as a srvany service, I 
> don't get my user specific environment variable definitions picked up (the 
> ones I define from the windows gui). I have to also define them in 
> ~/.ssh/environment. I was just asking if there was a way to avoid this extra 
> step.

Not yet. There's some code in Cygwin which loads the users
profile when the user context changes but

- it works only for local profiles, not for server based profiles
- it doesn't rearrange the user environment from the information
  in the user profile.

That's really serious: Patches gratefully accepted.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

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

* Re: openSSH under cygwin fix
@ 2001-04-25  8:16 Karl M
  2001-04-25 13:58 ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Karl M @ 2001-04-25  8:16 UTC (permalink / raw)
  To: C, cygwin

Hi C...

I understand what you are saying, and agree with that.

What I am saying is that when I use sshd running as a srvany service, I 
don't get my user specific environment variable definitions picked up (the 
ones I define from the windows gui). I have to also define them in 
~/.ssh/environment. I was just asking if there was a way to avoid this extra 
step.

Thanks,

...Karl


>From: "C" <C@Gryning.com>
>To: <cygwin@cygwin.com>
>Subject: Re: openSSH under cygwin fix
>Date: Wed, 25 Apr 2001 15:26:39 +0100
>
>Yes.....
>start the sshd as a service with logon of different user.......make sure
>that user has the logon priveledges detailed in the openssh
>documentation.....
>
>this has other benefits too.....not being as system
>easier to audit
>easier to kill process
>
>Regards
>C
>
>
>Hi Corinna...
>
>But when the process is spawned, it has the environment of SYSTEM or the
>user running the sshd daemon instead of the target user. Is it possible to
>change that?
>
>For now, I just set the ~/.ssh/environment to fix things up. But that
>requires maintaining two copies of my environment definitions...one for
>win2k and one for sshd.
>
>Thanks,
>
>...Karl
>
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

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

* Re: openSSH under cygwin fix
@ 2001-04-25  7:26 C
  0 siblings, 0 replies; 7+ messages in thread
From: C @ 2001-04-25  7:26 UTC (permalink / raw)
  To: cygwin

Yes.....
start the sshd as a service with logon of different user.......make sure
that user has the logon priveledges detailed in the openssh
documentation.....

this has other benefits too.....not being as system
easier to audit
easier to kill process

Regards
C


Hi Corinna...

But when the process is spawned, it has the environment of SYSTEM or the
user running the sshd daemon instead of the target user. Is it possible to
change that?

For now, I just set the ~/.ssh/environment to fix things up. But that
requires maintaining two copies of my environment definitions...one for
win2k and one for sshd.

Thanks,

...Karl


>From: Corinna Vinschen <cygwin@cygwin.com>
>To: cygwin@sources.redhat.com
>Subject: Re: openSSH under cygwin fix
>Date: Wed, 25 Apr 2001 15:08:13 +0200
>
>On Wed, Apr 25, 2001 at 01:41:19PM +0100, Gaz Jones wrote:
> > Hi, first, thanks for the great cygwin and for the work on
> > the openSSH port. I _think_ I may have found a problem (I
> > may not have, have only been playing around with the
> > code so far :), in that the PATH under Windows doesn't
> > seem to be getting set after I log in. The relevant
> > lines are in session.c (1205 - 1213):
> >
> > # ifndef HAVE_CYGWIN
> >   /*
> >    * There's no standard path on Windows. The path contains
> >    * important components pointing to the system directories,
> >    * needed for loading shared libraries. So the path better
> >    * remains intact here.
> >    */
> >   child_set_env(&env, &envsize, "PATH", _PATH_STDPATH);
> > # endif /* HAVE_CYGWIN */
> >
> > Changing the # endif line to:
> >
> > #else
> >   child_set_env(&env, &envsize, "PATH", getenv("PATH"));
> > #endif /* HAVE_CYGWIN */
> >
> > fixes this. This could be a result of my setting up a very bare
> > bones cygwin setup (testing to see how little I need to have a
> > running SSH setup) and using cmd.exe as my shell.
>
>I appreciate your effort but I'm surprised that your above
>fix should change anything.  If you examine session.c again,
>you will find a few lines above the following code:
>
>=== SNIP ===
>#ifdef HAVE_CYGWIN
>         /*
>          * The Windows environment contains some setting which are
>          * important for a running system. They must not be dropped.
>          */
>         copy_environment(&env, &envsize);
>#endif
>=== SNAP ===
>
>This code copies the whole environment. Call `ssh -v'. That will
>print the environment which is inherited to the shell. You will
>have to start sshd with -d option, though.
>
> > I also found that when using sftp-server, if you didn't use
> > sh (or a typical UNIX shell I assume), I couldn't sftp to the
> > server - to fix this I added some code that would check for
>
>Yep, that's a cmd problem. Any UNIX shell works.
>
> > an environment variable called NEWSHELL and would use that
> > as the shell if it was specified. Hence, when using sftp I
> > can use sh, but with SSH I can use cmd.exe. I can mail the
> > few extra lines of code for this if you want.
>
>Hmm, I'm not quite sure if the OpenSSH maintainers will like
>that patch. If you really want to get it into the official
>OpenSSH sources I suggest sending the patch to the mailing list
>openssh-unix-dev@mindrot.org. I'm trying to avoid any special
>Cygwin code which is not in the official sources.
>
>Corinna
>
>--
>Corinna Vinschen                  Please, send mails regarding Cygwin to
>Cygwin Developer                                mailto:cygwin@cygwin.com
>Red Hat, Inc.
>
>--
>Want to unsubscribe from this list?
>Check out: http://cygwin.com/ml/#unsubscribe-simple
>



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

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

* Re: openSSH under cygwin fix
@ 2001-04-25  7:19 Karl M
  0 siblings, 0 replies; 7+ messages in thread
From: Karl M @ 2001-04-25  7:19 UTC (permalink / raw)
  To: cygwin

Hi Corinna...

But when the process is spawned, it has the environment of SYSTEM or the 
user running the sshd daemon instead of the target user. Is it possible to 
change that?

For now, I just set the ~/.ssh/environment to fix things up. But that 
requires maintaining two copies of my environment definitions...one for 
win2k and one for sshd.

Thanks,

...Karl


>From: Corinna Vinschen <cygwin@cygwin.com>
>To: cygwin@sources.redhat.com
>Subject: Re: openSSH under cygwin fix
>Date: Wed, 25 Apr 2001 15:08:13 +0200
>
>On Wed, Apr 25, 2001 at 01:41:19PM +0100, Gaz Jones wrote:
> > Hi, first, thanks for the great cygwin and for the work on
> > the openSSH port. I _think_ I may have found a problem (I
> > may not have, have only been playing around with the
> > code so far :), in that the PATH under Windows doesn't
> > seem to be getting set after I log in. The relevant
> > lines are in session.c (1205 - 1213):
> >
> > # ifndef HAVE_CYGWIN
> >   /*
> >    * There's no standard path on Windows. The path contains
> >    * important components pointing to the system directories,
> >    * needed for loading shared libraries. So the path better
> >    * remains intact here.
> >    */
> >   child_set_env(&env, &envsize, "PATH", _PATH_STDPATH);
> > # endif /* HAVE_CYGWIN */
> >
> > Changing the # endif line to:
> >
> > #else
> >   child_set_env(&env, &envsize, "PATH", getenv("PATH"));
> > #endif /* HAVE_CYGWIN */
> >
> > fixes this. This could be a result of my setting up a very bare
> > bones cygwin setup (testing to see how little I need to have a
> > running SSH setup) and using cmd.exe as my shell.
>
>I appreciate your effort but I'm surprised that your above
>fix should change anything.  If you examine session.c again,
>you will find a few lines above the following code:
>
>=== SNIP ===
>#ifdef HAVE_CYGWIN
>         /*
>          * The Windows environment contains some setting which are
>          * important for a running system. They must not be dropped.
>          */
>         copy_environment(&env, &envsize);
>#endif
>=== SNAP ===
>
>This code copies the whole environment. Call `ssh -v'. That will
>print the environment which is inherited to the shell. You will
>have to start sshd with -d option, though.
>
> > I also found that when using sftp-server, if you didn't use
> > sh (or a typical UNIX shell I assume), I couldn't sftp to the
> > server - to fix this I added some code that would check for
>
>Yep, that's a cmd problem. Any UNIX shell works.
>
> > an environment variable called NEWSHELL and would use that
> > as the shell if it was specified. Hence, when using sftp I
> > can use sh, but with SSH I can use cmd.exe. I can mail the
> > few extra lines of code for this if you want.
>
>Hmm, I'm not quite sure if the OpenSSH maintainers will like
>that patch. If you really want to get it into the official
>OpenSSH sources I suggest sending the patch to the mailing list
>openssh-unix-dev@mindrot.org. I'm trying to avoid any special
>Cygwin code which is not in the official sources.
>
>Corinna
>
>--
>Corinna Vinschen                  Please, send mails regarding Cygwin to
>Cygwin Developer                                mailto:cygwin@cygwin.com
>Red Hat, Inc.
>
>--
>Want to unsubscribe from this list?
>Check out: http://cygwin.com/ml/#unsubscribe-simple
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

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

* Re: openSSH under cygwin fix
  2001-04-25  5:46 Gaz Jones
@ 2001-04-25  6:08 ` Corinna Vinschen
  0 siblings, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2001-04-25  6:08 UTC (permalink / raw)
  To: cygwin

On Wed, Apr 25, 2001 at 01:41:19PM +0100, Gaz Jones wrote:
> Hi, first, thanks for the great cygwin and for the work on
> the openSSH port. I _think_ I may have found a problem (I
> may not have, have only been playing around with the
> code so far :), in that the PATH under Windows doesn't
> seem to be getting set after I log in. The relevant
> lines are in session.c (1205 - 1213):
> 
> # ifndef HAVE_CYGWIN
>   /*
>    * There's no standard path on Windows. The path contains
>    * important components pointing to the system directories,
>    * needed for loading shared libraries. So the path better
>    * remains intact here.
>    */
>   child_set_env(&env, &envsize, "PATH", _PATH_STDPATH);
> # endif /* HAVE_CYGWIN */
> 
> Changing the # endif line to:
> 
> #else
>   child_set_env(&env, &envsize, "PATH", getenv("PATH"));
> #endif /* HAVE_CYGWIN */
> 
> fixes this. This could be a result of my setting up a very bare
> bones cygwin setup (testing to see how little I need to have a
> running SSH setup) and using cmd.exe as my shell.

I appreciate your effort but I'm surprised that your above
fix should change anything.  If you examine session.c again,
you will find a few lines above the following code:

=== SNIP ===
#ifdef HAVE_CYGWIN
        /*
         * The Windows environment contains some setting which are
         * important for a running system. They must not be dropped.
         */
        copy_environment(&env, &envsize);
#endif
=== SNAP ===

This code copies the whole environment. Call `ssh -v'. That will
print the environment which is inherited to the shell. You will
have to start sshd with -d option, though.

> I also found that when using sftp-server, if you didn't use
> sh (or a typical UNIX shell I assume), I couldn't sftp to the
> server - to fix this I added some code that would check for

Yep, that's a cmd problem. Any UNIX shell works.

> an environment variable called NEWSHELL and would use that
> as the shell if it was specified. Hence, when using sftp I
> can use sh, but with SSH I can use cmd.exe. I can mail the
> few extra lines of code for this if you want.

Hmm, I'm not quite sure if the OpenSSH maintainers will like
that patch. If you really want to get it into the official
OpenSSH sources I suggest sending the patch to the mailing list
openssh-unix-dev@mindrot.org. I'm trying to avoid any special
Cygwin code which is not in the official sources.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

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

* openSSH under cygwin fix
@ 2001-04-25  5:46 Gaz Jones
  2001-04-25  6:08 ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Gaz Jones @ 2001-04-25  5:46 UTC (permalink / raw)
  To: cygwin

Hi, first, thanks for the great cygwin and for the work on
the openSSH port. I _think_ I may have found a problem (I
may not have, have only been playing around with the
code so far :), in that the PATH under Windows doesn't
seem to be getting set after I log in. The relevant
lines are in session.c (1205 - 1213):

# ifndef HAVE_CYGWIN
  /*
   * There's no standard path on Windows. The path contains
   * important components pointing to the system directories,
   * needed for loading shared libraries. So the path better
   * remains intact here.
   */
  child_set_env(&env, &envsize, "PATH", _PATH_STDPATH);
# endif /* HAVE_CYGWIN */

Changing the # endif line to:

#else
  child_set_env(&env, &envsize, "PATH", getenv("PATH"));
#endif /* HAVE_CYGWIN */

fixes this. This could be a result of my setting up a very bare
bones cygwin setup (testing to see how little I need to have a
running SSH setup) and using cmd.exe as my shell.

I also found that when using sftp-server, if you didn't use
sh (or a typical UNIX shell I assume), I couldn't sftp to the
server - to fix this I added some code that would check for
an environment variable called NEWSHELL and would use that
as the shell if it was specified. Hence, when using sftp I
can use sh, but with SSH I can use cmd.exe. I can mail the
few extra lines of code for this if you want.

l8r,
g



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

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

end of thread, other threads:[~2001-04-25 13:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-25  7:20 openSSH under cygwin fix Karl M
  -- strict thread matches above, loose matches on Subject: below --
2001-04-25  8:16 Karl M
2001-04-25 13:58 ` Corinna Vinschen
2001-04-25  7:26 C
2001-04-25  7:19 Karl M
2001-04-25  5:46 Gaz Jones
2001-04-25  6:08 ` Corinna Vinschen

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