From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: sshd default user PATH
Date: Thu, 14 Aug 2014 12:17:00 -0000 [thread overview]
Message-ID: <20140814121700.GA25497@calimero.vinschen.de> (raw)
In-Reply-To: <20140814112006.GA22411@calimero.vinschen.de>
[-- Attachment #1: Type: text/plain, Size: 2824 bytes --]
On Aug 14 13:20, Corinna Vinschen wrote:
> On Aug 14 09:56, Achim Gratz wrote:
> > I'm trying to figure out how sshd comes up with the PATH for the initial
> > environment. Currently I get the Windows sytem PATH (converted to POSIX)
> > and then /bin appended. This is no good, at least /bin should be at the
> > beginning of that PATH.
>
> On other systems sshd sets $PATH to "/usr/bin:/bin:/usr/sbin:/sbin", but
> on Cygwin it doesn't change $PATH and just takes what it got from
> cygrunsrv so as not to break the search path for DLLs not in the system
> directories.
>
> So this is kind of a cygrunsrv problem. It simply appends /bin to
> $PATH, rather than prepending it.
>
> > I've not been able to change this system-wide so far. Apparently sshd has
> > been built on a machine where /etc/default/login wasn't present, at least it
> > doesn't appear to try to read that file (or any other system file) for
> > setting up the initial environment.
>
> Right, /etc/default/login and, fwiw, any method to change $PATH from the
> default path is disabled on Cygwin deliberately for the reason outlined
> above.
>
> > The /etc/sshrc is run if I create it,
> > but you can't set any environment variables from within it. I don't want to
> > enable user environments.
> >
> > I think it would be nice if there was a system file that could set the
> > initial environment for sshd, maybe setting external_path_file to
> > /etc/ssh_environment fits in better with the default Cygwin /etc layout, though.
>
> It's not that simple. It requires a code change in sshd. However,
> maybe the rigorous handling is not required anymore these days.
>
> Anyway, even if I re-enable /etc/default/login and the standard PATH
> handling in sshd, there's no way to set an arbitrary environment. For
> security reasons, sshd is very selective in the environment variables it
> sets up. From /etc/default/login, it takes *only* PATH and UMASK,
> for instance. Everything else should be set in the shell profiles.
>
> So, here's what I'll do:
>
> - Change cygrunsrv to prepend /bin to $PATH rather then appending it.
>
> - Drop the Cygwin specific ignorance of /etc/default/login from the
> source code and build a new OpenSSH package.
>
> Does that sound ok?
There's a problem. On Cygwin it's not /etc/default, but /etc/defaults.
Note the trailing "s".
OpenSSH only provides support for /etc/default/login with no way to
influence the name or path. This would require a patch to openssh just
for the sake of Cygwin. I asked upstream, but I don't expect that this
will be changed any time soon.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-08-14 12:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 9:57 Achim Gratz
2014-08-14 11:20 ` Corinna Vinschen
2014-08-14 12:17 ` Corinna Vinschen [this message]
2014-08-14 12:50 ` Andrey Repin
2014-08-14 12:28 ` Achim Gratz
2014-08-14 13:01 ` Achim Gratz
2014-08-14 15:19 ` Corinna Vinschen
2014-08-19 9:08 ` Achim Gratz
2014-08-19 10:58 ` Corinna Vinschen
2014-08-19 11:22 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140814121700.GA25497@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).