This is the mail archive of the
mailing list for the Cygwin project.
Re: What would it take to get Cygwin and NTFS file permissions to play nice?
- From: Eliot Moss <moss at cs dot umass dot edu>
- To: cygwin at cygwin dot com
- Date: Fri, 12 Aug 2016 22:59:34 -0400
- Subject: Re: What would it take to get Cygwin and NTFS file permissions to play nice?
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com>
- Reply-to: moss at cs dot umass dot edu
On 8/12/2016 10:26 PM, Thomas Taylor wrote:
I use rsync to back up my Cygwin user directories to an external USB disk drive, formatted as NTFS.
This fails from time to time, usually due to permission failures when trying to update the
destination files. The Windows permissions of the destination files turn out to be in the wrong
order, and to contain extraneous entries. Further checking of other files on the destination drive
reveal the same problem with their Windows permissions. Rather that try to correct the Windows
permissions of each file in turn, I go as far up the directory tree as needed, and recursively reset
all Windows file permissions all the way down. When I then rsync the USB drive back to my user
directories, the UNIX permissions of every file are now set to executable. This has the unfortunate
effect of granting execute permission on every file restored, even those that are not executable. I
gave up on correcting the permissions of the restored files (via a long-running recursive script),
and learned to live with the problem. Until now, that is. I thought I'd try "ls --color", and was
disappointed to find that almost everything (except directories and symbolic links) came out light
green. This happened because almost everything was marked as executable, and this happened because
rsync mangled the Windows permissions, which are most easily reset to be the same on all files in a
given directory and all subdirectories. These Windows permissions inevitably involve "Full Control"
(including execute permission) for somebody, especially the owner. Yeah, I've read the Cygwin doc
on this, and I get the feeling that solving it is too difficult/impossible/not worth the effort.
For starters, could we at least set the Windows permissions in proper order?
I won't wade into the argument as to what constitutes "proper" order. I will just say that I have
tended to get better result when I have given files a group different from the one associated with
my user name. To wit, my user name is "moss" and that is the "group" with Windows typically
associates with my files. But I established another group, that I choose to call "Cygwin", and
then I give my cygwin-oriented files group "Cygwin", which at least allows their group permissions
to be set more as permissions go under POSIX.
I have also found it helpful (perhaps necessary), for the sake of access by backup programs, to
add explicit read access by user "SYSTEM". Cygwin's current permission scheme recognizes this
specially, ignoring system/admin access since it is like that of root under POSIX.
Perhaps some of this will help you figure out a good way to set your permissions. I agree that
it is sometimes a pain, but I also think that Corinna and the Cygwin community have converged on
what is likely the best solution to a complex problem that may have no ideal solution.
Regards -- Eliot Moss
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple