This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Windows 8 group won't respect /etc/passwd or /etc/group


On Jan  8 01:18, John Smith wrote:
> Hi there,
> I've been struggling with an issue trying to figure out why Windows
> 8.1 won't seem to respect the trick of setting your /etc/password to
> use a default group such as users instead of 'none'.  There are a
> few other discussions on this board around changing the group to
> "Users" and modifying the /etc/passwd to have a default group.

Not sure if the User's Guide is explaining it badly or not, but "None"
*is* a group.  It's the primary (what you call "default") group for all
users on a local machine not connected to a Windows domain, and it has
the SID S-1-5-21-<xxx>-<yyy>-<zzz>-513.  If you call mkgroup -l it shows
up like this:

  None:S-1-5-21-3229976424-329291882-2774727752-513:513:

assuming you have an english system, otherwise you see a localized
group name.


> The issue I am stumped over is that if I create a file using windows
> explorer (or anything else outside of cygwin), when I go to ls the
> file in cygwin, the group is coming back as none.

Yes, of course.  Changing the primary group via /etc/passwd only
works for Cygwin processes and their child processes.  It does not
change the default user token of all processes.  How should that
work, especially since the OS itself doesn't allow to change the
primary group of local user accounts.

> Well, technically
> it's coming back as 4294967295.  (64 bit cygwin)

This can only happen if you dropped the "None" group from your
/etc/group file.  mkgroup -l > /etc/group will rectify it.



> Even stranger, I can change the file manually with a chgrp Users and
> it looks and acts fine, but if I go to edit the file with notepad or
> any other external application, the group gets reset back to
> 4294967295.

Except for the 4294967295, which is just a missing entry for "None" in
/et/cgroup, this is normal.  See above.  It's not a problem of the OS or
Cygwin, you're just misunderstanding how this works.  User tokens
are propagated from process to child process.  The parent processes
of any first Cygwin process is a native Windows process with an
unchanged user token, so it has "None" as primary group.  At startup
of the first Cygwin process, it reads /etc/passwd and /etc/group
and changes the primary group in its user token if requested by your
settings.  This changed user token will be inherited by child processes
started from this process and subsequent processes, but it does not
affect the user tokens of unrelated processes, especially not of
non-CYgwin processes started from Explorer.  If you want Notepad to
use your group setting, start it from a Cygwin process.

Btw., the name of a group is irrelevant except for printing purposes.
So you are free to change it.  Rather than switching your primary group
from 513 to 545, you can also simply change the name of the None group
to whatever you like:

  MyGroup:S-1-5-21-3229976424-329291882-2774727752-513:513:

Just keep in mind that the three numbers in the middle of the SID 
are machine specific, so don't copy/paste this line from my mail!
Run mkpasswd -l to create this line for your machine and then change
the name of the group to your liking.


Corinna

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

Attachment: pgpkYY4Ah6NnS.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]