How to fix incorrect Cygwin permission in Windows 7

Cygwin started to behave quite strangely after recent updates. I was not able to edit files in vim, because it was complaining that files are read only. Even cp -r didn’t work correctly. Permission of new directory was broken and I was not able to remove it. Pretty weird behavior.

E.g. ls -l

total 2
----------+ 1 georgik None 34 Jul 14 18:09 index.jade
----------+ 1 georgik None 109 Jul 14 17:40 layout.jade

Hm. It is clear that something is wrong with permission. Even owner has no permission on those files.

Output of mount command:

C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)

I found a solution at cygwin forum. It’s quite easy to fix it.

Open /etc/fstab and enter following line:

none /cygdrive cygdrive binary,noacl,posix=0,user 0 0

Save it. Close all cygwin terminals and start new terminal.

Output of mount:

C: on /cygdrive/c type ntfs (binary,noacl,posix=0,user,noumount,auto)

Output of ls -l

total 2
-rw-r--r-- 1 georgik None 34 Jul 14 18:09 index.jade
-rw-r--r-- 1 georgik None 109 Jul 14 17:40 layout.jade

Rating: 5.0/5. From 6 votes.
Please wait...

Leave a comment

14. July 2012 at 18:23 - Software engineering (Tags: , , , , ). Both comments and pings are currently closed.

12 Responses to “How to fix incorrect Cygwin permission in Windows 7”

  • Endre says:

    Thanks georgik, it has helped!!
    Endre

    No votes yet.
    Please wait...
  • Ken says:

    Thank you! This works!

    No votes yet.
    Please wait...
  • Michael says:

    Thanks! This also works on Windows 8.1

    No votes yet.
    Please wait...
  • nanoix9 says:

    Thanks! Simple & clear & really works!

    No votes yet.
    Please wait...
  • DaveP says:

    Brilliant – worked for me.

    No votes yet.
    Please wait...
  • DB says:

    Note this specifically uses “noacl” to force ignorance of NTFS permissions, and thus the only level of control you will be able to have over files will be the read-only bit. This might be enough for you guys’ situations, but it should not be recommended without caveats.

    No votes yet.
    Please wait...
  • georgik says:

    @DB: thank you for explanation. Do you have any solution that would be more systematic? I would appreciate it. I do not like just “good enough solutions” (aka hacks).

    No votes yet.
    Please wait...
  • Flassari says:

    Ahh perfect, thanks!

    No votes yet.
    Please wait...
  • Ben Mead says:

    This is an old thread, but I wonder… Is there any way to make Cygwin play nice with creating an acl on new files?

    No votes yet.
    Please wait...
  • Ben Mead says:

    This is an old thread, but I wonder… Is there any way to make Cygwin play nice when creating an acl on new files for a shared drive mounted in another domain?

    No votes yet.
    Please wait...
  • Ben Mead says:

    Ah, I see. The details on how it calculates the default ACL for a new file is in here somewhere: https://cygwin.com/cygwin-ug-net/ntsec.html. Will take some investigation to see what’s going on.

    No votes yet.
    Please wait...
  • Mark Lavrijsen says:

    When I use for example the Cygwin zip command to ZIP a file, I’m unable to open that file with Windows file explorer(with other administrator account) unless I do serious NTFS file permission editing. Explorer also states that “permissions are incorrectly ordered”.
    This is with Cygwin installed today on fully patched Windows 2012R2.

    Ins’t the whole idea that Cygwin integrates with Windows, thus semi-complying(I’m pretty well versed in Unix/Linux and Windows, so I know that there are mayor differences regarding permissions on files) with things like folder permission inheritance and stuff like that unless explicitly wanted otherwise?
    As it is now, it throws some serious permission barriers between the 2 systems.
    Ps. noacl in /etc/fstab seems to work for my issue.

    No votes yet.
    Please wait...