Tuesday, January 19, 2010

CYGWIN=nontsec in Cygwin 1.7-speak

Cygwin has always royally screwed up NTFS permissions for new files. For some reason it duplicates a new set of permissions for every file instead of inheriting from the parent (some impedance mismatch between POSIX and NT semantics, oh well). CYGWIN=nontsec allowed me (in Cygwin 1.5) to disable this and create files with (Windows) default permissions.

But, alas, Cygwin 1.7 rolled around and now to achieve the same thing we have to muck with /etc/fstab. This is probably a better solution in the long run, as configuration through environment variables is a bit of a mess.
D:/cygwin/bin   /usr/bin    ntfs        binary,auto,noacl           0   0
D:/cygwin/lib /usr/lib ntfs binary,auto,noacl 0 0
D:/cygwin / ntfs override,binary,auto,noacl 0 0
none /cygdrive cygdrive binary,posix=0,user,noacl 0 0

Replace D:/cygwin with your install directory. Note the "noacl" at the end of all the mount options. "override" is necessary for the root directory because Cygwin's default mount point is "immutable" (mount.cc line 342).

6 comments:

VST said...

Hi Catalin,

I have copssh running and I'm having same permission issue. There is a folder which users use for ftp. How do I add it in fstab file.

Suppose the folder is c:\ftpshare

How do I write this in fstab so permissions are inherited.

OS is windows server 2008 R2

Thanks

Catalin Patulea said...

Check out this blog post, there's a couple examples of mapping of Windows paths in Cygwin.

Collin said...

I was wondering if you had ever finished up your smart card hacking project. My laundry just switched over to that, with a nice helping of higher costs, so I am looking to get around that.
At the end of the last portion of the laundry series you had something about a kit from Atmel. Did that work out?
Cheers.

Harie said...

HI Catalin,

I am going mad with permissions in cygwin. I have set the /etc/fstab file as per your comments. For any new folder,new file being created manually or via the cygwin bash shell the permissions are being properly inherited from its parent folder. I have given modify permissions to the Users Group for the C:\Cygwin folder.
BUT , only files that are being installed later by the setup.exe are not inheriting these permissions. Can you please help

Adrian Vintu said...

Thank you Catalin, worked like a charm :)

Gaƫtan de Menten said...

Thanks, it helped a lot. I will just add that for the changes to actually apply/fstab to be reloaded, all cygwin processes need to be killed, so that the fstab table in memory is cleared and the modified fstab is actually read on the disk. This puzzled me for quite a while...