chmod g+s ineffective

Norton Allen allen@huarp.harvard.edu
Wed Jun 29 17:51:39 GMT 2022


On 6/29/2022 9:18 AM, Norton Allen wrote:
> On 6/29/2022 7:39 AM, Andrey Repin wrote:
>> Greetings, Norton Allen!
>>
>>> 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
>> ----------------^
>>
>> $ getfacl foo
>
> I will collect this shortly, but IIRC, getfacl showed it was not set. 
> I did see it set there under 'flags' on the system that works.

    nort@EAS-SOFTWAREE1B ~
    $ ls -ld foo
    drwxrwxr-x 1 nort flight 0 Jun 29 06:25 foo

    nort@EAS-SOFTWAREE1B ~
    $ chmod g+s foo

    nort@EAS-SOFTWAREE1B ~
    $ ls -ld foo
    drwxrwxr-x 1 nort flight 0 Jun 29 06:25 foo

    nort@EAS-SOFTWAREE1B ~
    $ getfacl foo
    # file: foo
    # owner: nort
    # group: flight
    user::rwx
    group::rwx
    other::r-x


>
>
>>
>>> I ran strace, and it looks like the correct system call parameter is 
>>> getting passed.
>>> I am curious as to how the sticky bit is implemented.
>> First see if it was set or not.
>>
>>> It isn't obvious what underlying Windows functionality (if any) is 
>>> applied.
>> It does. But the big question is, where do you try to do that.
>> If this is inside Cygwin installation root, then things could work 
>> more or
>> less POSIX'y. If this is outside Cygwin root (f.e. in your system 
>> profile), it
>> may or may not work completely, depends how did you mount /cygdrive 
>> prefix.
>
> I will confirm (shortly), but I'm pretty sure these tests were done 
> under vanilla /home (so c:\cygwin64\home)


Confirmed (as shown above). Tested in /home/nort on directory /home/nort/foo


>
>
>>
>>> Ah, just checked on a system where this works, and creating a file 
>>> in the
>>> directory from the
>>> command shell does not set the group, so presumably this 
>>> functionality is
>>> all within cygwin. That works for my application, except when it 
>>> doesn't.
>>> Any suggestions on what I should look for?
>> Look if you could avoid using +s. Isn't DACL enough?
>
> Am I correct that DACL is not available unless I am on a domain? This 
> is for a field computer, so connection to a domain is generally more 
> problematic than helpful.
>

So is this implemented using DACL under the hood? And is that expected 
to fail without a domain?



More information about the Cygwin mailing list