delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/07/23/04:58:14

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=uphEB0iWcrY+f1sv+cRKdjsQKXi+nokXeQ8aZgTjXBrNrICFUpV5s
ELnwKJ5zo3D/vmz1PrlfMiiqXj64ijVdZ3sprP7wkcQzjdUk3kgr2lxl4jnIROr6
dBY1FcDPfOpf6SQ/YoW+Ks+2RhDemnTAFE4pRyKn44BTdVeekLV748=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=7mr+2qtcacKTu1TZEHC49IQvLw4=; b=UMIFIkpehllkj2SQaOKXjILsjhAx
NZ2c18UO2qIs9Kvuez3rzPQtSZvb4cYwejhWW26XGsg1HeDE+Mlaa3o+OLm3V+bv
bxmuiKBryjqtmoOYChOB6DlofztJuM9Xq7lNact9Oh4SBGfQUQ3YoXCDiTGByn3N
yLC0lYHTuAwjl+4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2
X-HELO: calimero.vinschen.de
Date: Thu, 23 Jul 2015 10:57:52 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: db_home setting in nsswitch.conf is ignored.
Message-ID: <20150723085752.GA29506@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <1568721912 DOT 554752 DOT 1437593133260 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com> <143607434 DOT 20150723005320 AT yandex DOT ru>
MIME-Version: 1.0
In-Reply-To: <143607434.20150723005320@yandex.ru>
User-Agent: Mutt/1.5.23 (2014-03-12)

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jul 23 00:53, Andrey Repin wrote:
> Greetings, Shaun Martin!
>=20
> >> Is HOME set in the Windows environment already?  If so, this
> >> might interact with the setting in /etc/nsswitch.conf, which *only*
> >> works for entries taken from the passwd DB (getpwnam, getpwuid calls).
> >>=20
> >> How do you start mintty?  It should be started with a single parameter,
> >> a dash, e.g.:
> >>=20
> >>   C:\cygwin64\bin\mintty.exe -
>=20
> > Yes, HOME is set in the Windows environment and I am not able to change=
 it.
>=20
> How so?...

I think admins can disallow changing your default user environment via
policy.  But that only means you can't change the env for the *first*
process in a process tree.  See below.

> > With the "SET" command in a Windows command prompt I can see:
>=20
> > HOME=3DSERVER/USERS5:USERS\SHAUN
>=20
> That's suspicious. So many symbols not allowed to be there.

I agree.

For a start, this behaviour of Cygwin has not chaged since at least
2002:

When being started from a non-Cygwin process (e.g. cmd, explorer),
Cygwin checks if the environment variable $HOME is already set.  If so,
it uses it verbatim.  Otherwise, it generates a value for $HOME
from the user's passwd DB entry or, if that fails for some reason,
falls back to generate a POSIX path from $HOMEDIR/$HOMEDRIVE.

The above value of $HOME is really a problem here.  Not only that
it exists and doesn't actually reflect your HOME, it's also not
starting with a slash and thus is evaluated as a *relative* path.
Therefore your resulting HOME will depend on the current directory
you're starting the Cygwin process from.

The fact that your actual home directory in the passwd DB is set
differently doesn't matter anymore then.  I.e., the output of

  $ getent passwd <your-account>

will very likely show something different as pw_dir entry.

On a second look into your OP, I'm also a bit puzzled about the
settings you made in /etc/nsswitch.conf.  No offense meant, but
it seem you just used some arbitrary settings without actually
reading what they mean and how to configure them (e.g. cygwin, desc).

Is there a problem understanding
https://cygwin.com/cygwin-ug-net/ntsec.html?  I'm always grateful for
hints how to improve the docs, even more so for patches to the docs.

> > When you say it only works for entries taken from passwd DB, does that
> > mean I need to create a "/etc/passwd" file in order to change the
> > "db_home" directory with nsswitch.conf?
>=20
> No, she said that it only works if Cygwin has to retrieve these records f=
rom
> DB. If the information is already available, it will be used as is.

Right.

> > I'm starting mintty with the shortcut generated by the installer:
>=20
> > C:\Users\shaun\Apps\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -
>=20
> System properties - Advanced - Environment.
> Remove the HOME variable. It shouldn't be there for Windows to begin with.
> If that wouldn't work, talk to your domain admin, explain the situation a=
nd
> ask to resolve the conflict.
> If Cygwin is a necessary part of your workflow, there's a Cygwin-specific
> schema available which can be installed in domain to help facilitate prov=
ision
> of the necessary Cygwin-specific information.

Alternatively (if your admin is a BOFH), you can always drop HOME from
your powershell env before starting a Cygwin process.

Even more alternatively, what Cygwin *could* do in an upcoming version
is to check the incoming $HOME for validity, i.e., is it an absolute
POSIX path and does it resolve to an existing directory.  If not,
ignore it and try the entry from the passwd DB.

However, I'm rather reluctant to do that.  For one your case is a first.
Such a change could also have surprising side effects.  Maybe just
checking for a leading slash would work in most environments, but
still...


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--k+w/mQv8wyuph6w0
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVsKyQAAoJEPU2Bp2uRE+gmmsP/RagPDlK/pKcbYn48w4qRxaJ
ugUi2+2U7R01Yl2B1XPWoQvsrswTd58rpY40CUg6XosZyD/5F6DXklXbNlU4S4+K
CKv59iigWX5Fxd8OTAWS3TNO4ICgTbim81XsDsbUhI28rrf71xpCyjnqgYrIVi85
/LX4k5xrgrMmR5r4dTvKEfxtrab/42RlHCz335s99CfAg3qQL+4PkQs29aoXbb7Y
z+4z+OlCPkWca6jft4NJ00yhdHBMK0hGGOIjVL9U0MjR3XYGAHASt3HWxdrrEvjc
qA+QQEQU4pHj/a3on8rKcLm7g8taG5OLilP/d3z4cPRhh9kPib+h/jQ9Yqhczy9R
Ls33DCHKgmOa8i35dVnl9TXiUhGtYcqp6rLEcSaKz7aGB4dUeY9zJBTMvncSNr8t
o4E3p1P0JzG5Fl6gcCw+LhJuKyuytlSf8Ts+L5hwA7HZRczqWWKsSpKJ4FWPY6hC
vnljRgNDjm0oDQR7wjl0OBN2eD4z7WVFUKR+9b2NP55rlS1MzlQGIkbbY/m83f7t
oUOJ+I1MbeJG3afD3fyTVbcWAiOzZKj4C49G0ifsFGW8Tm7NXNxPXF1eZ5k+2v7R
oorWZc6dmA87MdpkBq0Rb4VbYlDx5o7lPI428uqm3e6t8QlS7jVixY8Vofty86wa
wKNXyQFuqqiYk06bm4Fb
=lQ5e
-----END PGP SIGNATURE-----

--k+w/mQv8wyuph6w0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019