www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/06/20/09:37:33

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 55KDbW822280984
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 55KDbW822280984
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=yt7q3WaT
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02D02383E119
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1750426651;
bh=ectWPmgSz6ZkSC7C+mVj9RnONQeM+kp/oDbjl0vA8TM=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=yt7q3WaThMJJaJL5KPo9ul6ZfFwiGbrUqwuEC454LujwFjyhPIj12CPfeyVEaMBf7
JymjhfpN2XqKrQjtnl8zAt7z2HwXGYuvdLEylzVmuE16cRoaont+wbuovcX38+NlkO
XTCbjZ2jEJyqYGicXJgEpY6HXeEtXuvj3kn0Y57M=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B2C8A385AC27
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B2C8A385AC27
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750426621; cv=none;
b=l8+nJu6Yd0h4/uQjSXWKFiWzjH9zZa4FzDqCjqVfN+aG8BxUdzzg60i2ZcHXWUVNEYErFtImqltnfF68bLmbfF46W4JU5sZ0NiVmIPuF7iAHEoSNMfhvCXNzOhR5JfmdfsfRtTQ/OOdtBq3HIOa9e8D8POGsfQgD/sFnfoNYf38=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1750426621; c=relaxed/simple;
bh=8ZGrz99wLEtrLEIc9pOtMlAa2i8ITcOK4MggA9ORKpg=;
h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
b=K53WLdubNTZ9YYasTD8QksOSvjIEbLXBiDLyKOAgh6zbUkCSFXmMDREDk0xIgk4GLkHjbjAzXDfWjNLhqFj/sqbSBEgP44rVcaQg23GKOt2QAGkgw+ha4dKS3g+Gc5HglUwuQ0wqDdhf7VLS9ute0QMFW9tWbLbfT4fJ11Tm274=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2C8A385AC27
X-ASG-Debug-ID: 1750426617-24039d08187924a0001-w5GHUG
X-Barracuda-Envelope-From: moss AT cs DOT umass DOT edu
X-Barracuda-RBL-Trusted-Forwarder: 128.119.240.136
DKIM-Filter: OpenDKIM Filter v2.11.0 mailsrv.cs.umass.edu 8DA565BDC9
X-Barracuda-RBL-Trusted-Forwarder: 172.26.64.86
Message-ID: <ea00166f-f02f-56c8-3bed-a972990d3025@cs.umass.edu>
Date: Fri, 20 Jun 2025 09:36:57 -0400
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Subject: Re: Test whether file is owned by a specific group from bash or
powershell level?
X-ASG-Orig-Subj: Re: Test whether file is owned by a specific group from bash
or powershell level?
To: Sebastian Feld <sebastian DOT n DOT feld AT gmail DOT com>, cygwin AT cygwin DOT com
References: <CAHnbEG+ZsNGEpy0uqwOPZ64gvUJqBA6=S1hmh7cfNZm1Q0+ynw AT mail DOT gmail DOT com>
In-Reply-To: <CAHnbEG+ZsNGEpy0uqwOPZ64gvUJqBA6=S1hmh7cfNZm1Q0+ynw@mail.gmail.com>
X-Barracuda-Connect: mailsrv.cs.umass.edu[128.119.240.136]
X-Barracuda-Start-Time: 1750426617
X-Barracuda-Encrypted: TLS_AES_256_GCM_SHA384
X-Barracuda-URL: https://barramail.cs.umass.edu:443/cgi-mod/mark.cgi
X-Barracuda-BRTS-Status: 1
X-Virus-Scanned: by bsmtpd at cs.umass.edu
X-Barracuda-Scan-Msg-Size: 933
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0
QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.7 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.143138
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Eliot Moss via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Eliot Moss <moss AT cs DOT umass DOT edu>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

On 6/20/2025 8:15 AM, Sebastian Feld via Cygwin wrote:
> Does Cygwin or POSIX have a tool to test whether a file is owned by a
> specific group?
> 
> Win32, like Linux and POSIX, has the concept that files have an owner,
> and a group (ref:https://learn.microsoft.com/en-us/windows/win32/api/aclapi/nf-aclapi-getsecurityinfo).
> 
> How can I test whether a file is owned by a given group name, or not?
> /usr/bin/test -g and -G do not help because they only look and gid,
> egid. But I want to pass the group's name as an argument.

With some help from the web, I found this:

   find foo -prune -printf '%g\n'

This prints the group name, giving a gid only if it can't find the name of the group

Also this:

   stat --format=%G foo

Then you can compare the result against the group you have in mind.

I found this all out with web search and running a few quick tests under cygwin.

Regards - Eliot Moss

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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