X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 27F663858400
Authentication-Results: sourceware.org;
 dmarc=none (p=none dis=none) header.from=plebeian.com
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=plebeian.com
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=plebeian.com; s=default; h=Content-Transfer-Encoding:Content-Type:
 Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender
 :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Ap0Z2E55nSCI1FWN9Ku8/Y9Q0Sp1LulJ2Nj1QRawsoY=; b=szAhyZKiAjVlR/ipdTDGdGA1Rn
 YjjGE636v6UAHsfBZ10eiZqilVpEGB+7CZ/8fPVY6dP2r5poVlxKZ5YKYMDOH7mN8Au8vYxi5c3hn
 AVTjGpofCzm6ERClRMg6VfN5jH5gAS6lbvsp3SjT3DwKRlD/tW6HLSb+iDiAnNUO8MB/cJaLHsMxK
 5NnOZP98zS4Wx9/pwcWZcpY/GAs+GDKaWxINm+jpoZz71Y2aoz9pRBZUHGfLiNhhBmcAZMi0HhB+8
 C2UJWVrkw+7EVOYzMoFmxUTQyythAOXxi7dObcuj5HZwy9QqNvNMop4cQRb32nznDmC7etI8YDihT
 eI5Uekgw==;
MIME-Version: 1.0
Date: Sun, 10 Jul 2022 22:17:12 -0400
From: Chris Wagner <wagnerc@plebeian.com>
To: cygwin@cygwin.com
Subject: Re: chmod g+s ineffective
In-Reply-To: <463526579.20220701025601@yandex.ru>
References: <9c053381-4466-ea8a-11d6-ea2e676d3b35@huarp.harvard.edu>
 <792558531.20220629153952@yandex.ru>
 <dd5e2750-5d86-0283-84fb-ef10efd4a8a0@huarp.harvard.edu>
 <7964c08d-83cb-aab3-5d1c-4a5f0a86bf0a@huarp.harvard.edu>
 <463526579.20220701025601@yandex.ru>
User-Agent: Roundcube Webmail/1.4.12
Message-ID: <ddda74cf906b99988ecbbb30f6f5ef0a@plebeian.com>
X-Sender: wagnerc@plebeian.com
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - www16.qth.com
X-AntiAbuse: Original Domain - cygwin.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - plebeian.com
X-Get-Message-Sender-Via: www16.qth.com: authenticated_id: wagnerc@plebeian.com
X-Authenticated-Sender: www16.qth.com: wagnerc@plebeian.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_05, BODY_8BITS,
 DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW,
 SPF_HELO_PASS, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 26B2Hr0P004264

>> On 6/29/2022 9:18 AM, Norton Allen wrote:
>>>>> On one machine I have, chmod g+s fails to set the sticky bit. The 
>>>>> >>> command
>>>>> does not return any error, but ls -l continues to show the bit not 
>>>>> set.
>>>>>      $ mkdir foo
>>>>>      $ chgrp flight foo
>>>>>      $ chmod g+ws foo
>>>>>      $ ls -ld foo
>>>>>      drwxrwxr-x+ 1 nort flight 0 Jun 29 06:50 foo

Hi.  The permission bits are implemented as normal Window's DACLs 
(Discretionary Access List).  +s is implemented magically with the NULL 
SID.  You can view it from Explorer or with icacls.  Try checking the 
return code (echo $?) from chmod.  Also try changing perms from 
Explorer.  You might not be able to set the NULL SID for some reason.

It works for me:
$ ls -ld z
drwxrwsr-x+ 1 wagnerc Users 0 Nov 24  2020 z

$ getfacl z
# file: z
# owner: wagnerc
# group: Users
# flags: -s-
user::rwx
group::r-x
group:Administrators:rwx
group:Users:rwx
mask::rwx
other::r-x
default:user::rwx
default:user:wagnerc:rwx
default:group::r-x
default:group:Administrators:rwx
default:group:Users:rwx
default:mask::rwx
default:other::r-x


$ icacls z
z NULL SID:(DENY)(Rc,S,WD,REA,WEA,X,DC)
   APPLEJACK\wagnerc:(F)
   BUILTIN\Users:(RX)
   BUILTIN\Administrators:(RX,W,DC)
   BUILTIN\Users:(RX,W,DC)
   Everyone:(RX)
   NULL SID:(OI)(CI)(IO)(DENY)(Rc,S,WD,REA,WEA,X,DC)
   CREATOR OWNER:(OI)(CI)(IO)(F)
   APPLEJACK\wagnerc:(OI)(CI)(IO)(RX,W,DC)
   BUILTIN\Users:(OI)(CI)(IO)(RX)
   BUILTIN\Administrators:(OI)(CI)(IO)(RX,W,DC)
   BUILTIN\Users:(OI)(CI)(IO)(RX,W,DC)
   Everyone:(OI)(CI)(IO)(RX)

Successfully processed 1 files; Failed processing 0 files

$ uname -a
CYGWIN_NT-6.1 applejack 3.1.0(0.340/5/3) 2019-11-19 13:58 x86_64 Cygwin



Thanks.

-- 
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

