How to use cp.exe from Cygwin and preserve permissions

mlissner picture mlissner · Dec 7, 2011 · Viewed 8.3k times · Source

I'm using cp.exe from Cygwin to copy files in Windows 7. Unfortunately, when I do the permissions of the file change.

I've tried using:

cp --preserve=all

But that doesn't work either, and when I check the security of the original file vs the copy, the copy has different permissions.

Clearly there must be a way to preserve permissions when copying using Cygwin, but I can't find it.

Answer

avg picture avg · Mar 14, 2013

I believe adding option noacl to the /cygdrive mount point in /etc/fstab will do what you want.

$ cat fstab
# For a description of the file format, see the Users Guide   
# http://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,posix=0,user,noacl 0 0

See http://cygwin.com/cygwin-ug-net/using.html#mount-table and discussion from the cygwin mailing list.