Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use cp.exe from Cygwin and preserve permissions [closed]

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.

like image 499
mlissner Avatar asked Dec 07 '11 19:12

mlissner


2 Answers

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.

like image 94
avg Avatar answered Sep 29 '22 12:09

avg


I did some more investigation about this after asking the question above.

Per this discussion with one of Cygwin's developers, it appears that Cygwin doesn't care about Windows permissions, and just sticks with the POSIX ones.

From what I can tell, POSIX permissions are a whole separate thing from the Windows ones, so yes, it's great that they're supported, but ultimately, Cygwin can't copy files and maintain normal Windows permissions. Making it useless to me. Much better to use Python or Ruby.

I would love to be proven wrong though.

like image 29
mlissner Avatar answered Sep 29 '22 12:09

mlissner