Last active
August 29, 2015 14:15
-
-
Save hsuh/9944c36d508e568b9126 to your computer and use it in GitHub Desktop.
Cygwin: recursive copy with ACLs or set noacl to solve file permisssion problems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cygwin's cp discards ACLs (complex windows permissions). You have to copy them separately as follows: | |
# First copy files themselves, with timestamps: | |
cp -a folder1 folder2 | |
# Set all ACLs of copies to ACLs of originals: | |
cd folder2 | |
find . | while read f ; do getfacl ../folder1/"$f" | setfacl -f - "$f" ; done | |
# or when permissions are equal for all files / directories: | |
getfacl folder1 > folder-perms | |
getfacl folder1/file > file-perms | |
find folder2 -type d -exec setfacl -f folder-perms '{}' \; | |
find folder2 -type f -exec setfacl -f file-perms '{}' \; | |
# or probably faster: | |
find folder2 -type d -print0 | xargs -0 setfacl -f folder-perms | |
find folder2 -type f -print0 | xargs -0 setfacl -f file-perms | |
(OR) | |
You can set noacl on etc/fstab as follows: | |
$ 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 | |
Sources: | |
http://snipplr.com/view.php?codeview&id=21820 | |
http://stackoverflow.com/questions/5828037/cygwin-sets-file-permission-to-000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment