Cygwin mkdir makes directory I don't have permissions to

6,461

The excess of DENY showed by icacls can be caused by the recent changes in cygwin dll (between 2.3 and current 2.5) . It took some round to be right and could have left files or directory with puzzling ACL.

To sanitize the ACLs, a -b switch was added to setfacl

setfacl -b foo

For reference https://cygwin.com/cygwin-ug-net/ov-new.html#ov-new2.4s

Share:
6,461

Related videos on Youtube

M.M
Author by

M.M

Professional C programmer for 16 years, mostly on embedded systems. Some Windows C++ development also.

Updated on September 18, 2022

Comments

  • M.M
    M.M over 1 year

    Using latest version of cygwin64 in Windows 10. I have managed to get a directory foo that has something strange about its permissions. I'm not quite sure how this happened but here are the symptoms:

    $ cd /f/temp/foo
    $ ls -lad .
    drwxrwx---+ 1 Mm None 0 Jun 16 14:03 .
    $ mkdir bar
    $ ls -lad bar
    d---rwx---+ 1 Mm None 0 Jun 16 14:17 .
    $ cd bar
    Permission denied
    $ umask
    0022
    

    This doesn't happen for other directories, e.g. /f/temp/ok. Using ls switches I cannot see any difference between f/temp/ok and /f/temp/foo.

    If I do chmod 775 bar then I can enter bar, but then making a directory under bar has the same problem. So this problem is stopping me doing git init in /f/temp/foo. Doing chown -R Mm * in the parent makes no difference.

    My question is: What is causing this problem and what is the proper fix?

    There are some differences visible with icacls but I'm not sure how to interpret them:

    $ cd /f/temp
    $ icacls ok  >ok.txt
    $ icacls foo >foo.txt
    $ diff -b ok.txt foo.txt
    1c1
    < ok NULL SID:(DENY)(Rc,S,REA,WEA,X,DC)
    ---
    > foo NULL SID:(DENY)(Rc,S,REA,WEA,X,DC)
    3c3
    <   DESKTOP-AO2AIEC\None:(RX)
    ---
    >    DESKTOP-AO2AIEC\None:(Rc,S,RA)
    8c8
    <   Everyone:(RX)
    ---
    >    Everyone:(Rc,S,RA)
    10,11c10,12
    <   CREATOR OWNER:(OI)(CI)(IO)(F)
    <   CREATOR GROUP:(OI)(CI)(IO)(RX)
    ---
    >    CREATOR OWNER:(OI)(CI)(IO)(DENY)(S,RD,WD,AD,REA,WEA,X,DC)
    >    CREATOR OWNER:(OI)(CI)(IO)(D,Rc,WDAC,WO,RA,WA)
    >    CREATOR GROUP:(OI)(CI)(IO)(Rc,S,RA)
    16c17
    <   Everyone:(OI)(CI)(IO)(RX)
    ---
    >    Everyone:(OI)(CI)(IO)(Rc,S,RA)
    

    I have got a workaround for now: make another directory under /f/temp, then use cp -r to copy all the files out of foo into the new directory, then delete foo and rename the new directory. If I use cp -a instead of cp -r the problem persists.

    • Admin
      Admin almost 8 years
      try setfacl -b foo
    • Admin
      Admin almost 8 years
      @matzeri that seemed to work - if you can write up an answer with an explanation i'll vote and accept
    • Admin
      Admin over 2 years
      This happened to me; turned out to be an issue with Windows permissions. I'm not sure what started it but I corrected the permissions in Windows and then creating a dir in cygwin terminal worked correctly.
  • M.M
    M.M almost 8 years
    The problem originated when I unzipped some files that were created by someone with a different version of cygwin, so that explanation makes sense