Switching groups with newgrp - how to get the new group with |GetTokenInformation()| ?
Brian Inglis
Brian.Inglis@SystematicSW.ab.ca
Sat Feb 24 16:57:11 GMT 2024
On 2024-02-23 14:15, Dan Shelton via Cygwin wrote:
> On Fri, 23 Feb 2024 at 19:45, Roland Mainz via Cygwin wrote:
>> After that /usr/bin/chgrp on Cygwin works on the NFSv4.1 filesystem,
>> but if I do a /usr/bin/newgrp+/usr/bin/touch it will not create files
>> with that new group, because nfsd_debug.exe only sees the default
>> primary group, not the new primary group set by /usr/bin/newgrp.
>>
>> Or is there a mistake - do I have to add the current user to the
>> Windows localgroup first somehow (like usermod on Linux) ?
>
> Yes, there is a mistake. You have to add the intended user to that group.
>
> Example:
> net localgroup mywingrp1 mywinuser44 /add
>
> HOWEVER, there is another Cygwin bug:
> "getent group mywingrp1" does not list any group members, even after
> "net localgroup mywingrp1 mywinuser44 /add", which is a POSIX
> violation.
No POSIX violation as getent and nsswitch came from Solaris, and despite
adoption by Linux, BSDs, and Cygwin, is not standardized as of SUSv5? draft
202x_d4.1.
Cygwin `getent group` depends on `/etc/nsswitch.conf` settings, defaults to
`files db`, and lists the contents of the entries in `/etc/group` and/or
Security Account Manager SAM groups and/or Active Directory AD groups (could
take a long while initially and is faster with cygserver caching).
See `getent(1)`.
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
More information about the Cygwin
mailing list