delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/02/10/06:37:25

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=epFUzW0pq2i39fl5+MlfbSrIO9DkXqLY2HQaBqrp62AjOrncMYkId
hDoPeycbUQMJUVvxyK46iHlyARRFEi5f5xcxIK7f8G4Ojpdo6vlgliTQP303gTtX
THiUBMdshek2NBP9ch963LUGM1p9cNeFY9M7BN/BwDHeHy0hPCB6Po=
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=ubGMveKjQkAJ8L9EQ9xJtWxgjrY=; b=IwrwzNmqmJbPtLd4DQSfkqB56+op
qXhGPSgCBEZNReskjhB60j5zRaKLJDiSGJmJsmvTOIiWtZHeKFeyK16Ic+i6QwWW
NPz55OXkt9MsrA+fq0D4dNHilWASwxhphOvJED8cj380kOJzEvQB5zs2XGjawUXG
Kw/YuKKXnZtxBaQ=
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=-93.9 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=cygwin-ug-net, cygwinugnet, UD:ntsec.html, ntsec.html
X-HELO: calimero.vinschen.de
Date: Wed, 10 Feb 2016 12:37:05 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: chmod failed: Invalid argument
Message-ID: <20160210113705.GA15391@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <trinity-f5aca8d9-16f5-41e1-a521-60beada36d8e-1453991058087 AT 3capp-gmx-bs39> <20160128144429 DOT GC27369 AT calimero DOT vinschen DOT de> <trinity-1207f321-8a47-46bf-99f9-9c2eb5b08d91-1453997213459 AT 3capp-gmx-bs39> <20160128172256 DOT GB18626 AT calimero DOT vinschen DOT de> <trinity-7ee91fc7-9323-4efa-bbe7-b3420e77c824-1454006627384 AT 3capp-gmx-bs39> <20160128204021 DOT GA7055 AT calimero DOT vinschen DOT de> <56AE6D83 DOT 9070201 AT gmx DOT de> <20160208142930 DOT GF12975 AT calimero DOT vinschen DOT de> <56BB1813 DOT 9050102 AT gmx DOT de>
MIME-Version: 1.0
In-Reply-To: <56BB1813.9050102@gmx.de>
User-Agent: Mutt/1.5.24 (2015-08-30)

--J/dobhs11T7y2rNN
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Feb 10 11:59, Rainer Blome wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>=20
> On 08.02.2016 15:29, Corinna Vinschen wrote:
> > On Jan 31 21:24, Rainer Blome wrote:
> >> On 28.01.2016 21:40, Corinna Vinschen wrote:
> >>>>> On a hunch, do you have old /etc/passwd and /etc/group
> >>>>> files
> >>>> There is no `/etc/group`, but `/etc/passwd` defines the
> >>>> group ID of my user as 513
> >> On a Cygwin 2.3.1 on a different machine, `/etc/passwd` also has=20
> >> 513 in the group column of all users. Yet, when I ask for `id`,
> >> I get something like this (translated):
> >>=20
> >> uid=3D197609(username) gid=3D197121(None) \=20
> >> Groups=3D197121(None),545(Users),...
> >=20
> > These values make sense.
>=20
> Please enlighten me. To me it looks as if cygwin or at least mkpasswd
> formerly used 513 as the gid for "None", and switched to 197121 at
> some point.

Keep in mind that uid and gid values are POSIX concepts, not Windows
concepts.  Windows uses a SID.  Cygwin translates SIDs into uids and
gids using either the preferred computation directly from SAM or AD, or
the uid/gid values mentioned in /etc/passwd and /etc/group.  What it
uses depends on the content of /etc/nsswitch.conf, and if the
/etc/passwd and /etc/group files exist or not.  See the User's Guide at
https://cygwin.com/cygwin-ug-net/ntsec.html for all the gory details.

513 was the gid value for "None" when fetched from /etc/group.  197121
is the computed gid value for the group "None", using the algorithm
explained in
https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-how:

  "None" is a local SAM account with RID 513, therefore its computed gid
  value is 0x30000 + 513 =3D 197121.

> I currently do not understand this:
>=20
> Before I changed gid of my user from 513 to 197121 in /etc/passwd, ls
> printed 513 as the group of files in the home directory. After the
> change, ls prints "None" as the group.

513 was probably missing from /etc/group, but it was mentioned in
/etc/passwd.  The ambiguity is the problem, but off the top of my head I
can't reproduce how Cygwin struggles to resolve it.  Not very well,
apparently.

> But 197121 is the id of None.
> At first sight, this looks like the file group ownership has changed
> from 513 to 197121,

Of course not.  The actual entry in the file's DACL contains the SID of
the group "None".  Everything else is just a mapping to the POSIX
concept of uids and gids.  Think of Cygwin's uid and gids as just a
virtual representation of the reality.  Either computed directly from
the SID, or taken from /etc/passwd and /etc/group if they exist and are
active per /etc/nsswitch.conf.

> but I do not see why that should have happened.
> >> No doubt. So what kind of maintenance do these files need? Should
> >> I have known that they do?
> >=20
> > They should match.  For instance, one problem is if your passwd=20
> > entry contains a gid not available in either the Windows user DB
> > or /etc/group.
>=20
> Does this mean that if /etc/passwd exists, /etc/group must also exist
> (and match)? Or that, if /etc/passwd gives a currently-non-canonical
> gid such as 513, /etc/group must exist and define that gid?

The latter in the first place.  Ideally you don't use the files at all
and let Cygwin compute the uid/gid values.  If you feel more comfortable
with, say, changing your home dir using an /etc/passwd entry, rather
than one of the other methods described in
https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch
you just generate a single passwd entry for your user:

  $ mkpasswd -c > /etc/passwd

Then change home dir or shell, but keep the rest of the line intact,
*especially* the uid and gid values since they will match the computed
values and not lead to ambiguity.


Corinna

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

--J/dobhs11T7y2rNN
Content-Type: application/pgp-signature; name="signature.asc"

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

iQIcBAEBCAAGBQJWuyDhAAoJEPU2Bp2uRE+ggOEP/37LhwLL+wByBNI/IGTs3OEl
PkW6zPfksIVfcxjySSgqiZFHqlvZEhwBlm6oFXNbwAi6ykSdk0WjzsEvnZelm1Az
7lppNK++R0s8zWtHqyhOyHNlge8sZxuc19C4YGyRTq+hCenNTbIiULokkmlibilY
CpaRqwlrKUiKTtbBoaI068MP/IG5+ofNy8Bg63tPWac/lrKRT0L2LfX3BrauoOD6
4cXezF1+5p/XA9703nHRvkSIcLEkE/YOC6JAsaKreeXtDl5quJnu8FXrXJIP86L0
IVnAICzhUqoTF59vxEP6DINZ2E+eFWQpaocMqjiUFlxJATkXU5z3p+PXs7tOShGT
DZPubY4a1VGtYiG0cxO7+rgMG7jzt8cfsKNTRqpoSFzW2x23kCr0R5IjO0x9W54w
Ie095vZYGViFbCLEPB6uFxatqO26XUeB+CBWeqLNokzcsOxLdM+3mmcnsDYeA/GF
b80EM070m2FYA8PwCrFlFKKtDtI//KjCbRBdrkRy80pvhZZ+TVtrhgA2u/LPcc8W
LCODfTD74U9UFn8HRyBG0OrCcWVfpibOeo+jxTJuT1FH+Y702HhJurP0GYgrgAS+
+fX4Yo8yvf9hJoGHrHfE/Do1UOGWPr9v5PWkoMCdxbNZkrLtHn0MEBG5P9WD0Jih
lJ/xnNOSO+63gSA4kS90
=kUEU
-----END PGP SIGNATURE-----

--J/dobhs11T7y2rNN--

- Raw text -


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