Forcing Cygwin to create sane permissions on Windows

If you use Cygwin to mainly manipulate files in your regular Windows filesystem, under /cygdrive/…, you have probably seen this message more than a few times:

“The permissions on <node> are incorrectly ordered, which may cause some entries to be ineffective”

You have also likely seen “NULL SID” as the top entry in permission lists.

The Cygwin website has a page about filemodes, which explains why this happens.

In short, you have to edit /etc/fstab in Cygwin, and add “noacl” to the mount options for /cygdrive. Here is my /etc/fstab, for reference:

# /etc/fstab
# 
#    This file is read once by the first process in a Cygwin process tree.
#    To pick up changes, restart all Cygwin processes.  For a description
#    see https://cygwin.com/cygwin-ug-net/using.html#mount-table

# This is default anyway:
#none /cygdrive cygdrive binary,posix=0,user 0 0
none /cygdrive cygdrive binary,noacl,posix=0,user 0 0

After editing this option, you have to stop every single Cygwin process for it to take effect. The easy way out is to reboot your system.

2 Comments

  • Jon Storch says:

    I have found a side effect of this is cygwin does not recognize the the execute bit on a file after setting it as executable in ‘chmod +x [FILENAME]’. They also do not appear as executable in ‘ls’ nor do they complete when trying to run. It’s a little confusing.

    • bolt says:

      Interesting. Yes, you probably can’t use cygwin permissions outside of the native file system if you don’t allow cygwin to set its own permissions. That makes sense.

      You’d have to keep your executables in your home directory, or within the native cygwin file system. I always do that for my use cases, so I’ve never run into the issue, but thanks for the heads up!

Leave a Reply

Your email address will not be published. Required fields are marked *