This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

File permissions problems with cp in Windows 7


I'm hoping you can help me understand a problem that's been plaguing me for some time.
I'm on a recent version of Cygwin (cygcheck -V reports 1.7.9) and I'm on Windows 7. I believe I have set up my /etc/passwd and /etc/group using mkpasswd and mkgroup in the appropriate way. If it makes a difference I am logged on to my machine as a domain user.

So I have a file created externally to Cygwin, just normal notepad for example. Let's say this is called hello.txt.

Within Cygwin I can cat this file:
tomq@spot /cygdrive/c/work/cygtest
$ cat hello.txt
tom
tomq@spot /cygdrive/c/work/cygtest

I create a subdirectory sub1:
$ mkdir sub1
Then copy hello.txt into that directory:
$ cp hello.txt sub1/

I can view the contents of sub1/hello.txt:
$ cat sub1/hello.txt
tom

However, if I then create another subdirectory
$ mkdir sub1/sub2
And copy into that:
$ cp hello.txt sub1/sub2

I then can't cat that file:
$ cat sub1/sub2/hello.txt
cat: sub1/sub2/hello.txt: Permission denied

Using getfacl gives me some insight, the key is in the different acls on sub1 and sub2:
$ getfacl .
# file: .
# owner: tomq
# group: Domain Users
user::---
group::---
group:SYSTEM:rwx
group:Administrators:rwx
group:Users:r-x
mask:rwx
other:---
default:user::---
default:group::---
default:group:SYSTEM:rwx
default:group:Administrators:rwx
default:group:Users:r-x
default:mask:rwx
default:other:---

$ getfacl sub1/
# file: sub1/
# owner: tomq
# group: Domain Users
user::rwx
group::r-x
group:SYSTEM:rwx
group:Administrators:rwx
group:Users:r-x
mask:rwx
other:r-x
default:user::rwx
default:group::r-x
default:group:SYSTEM:rwx
default:group:Administrators:rwx
default:group:Users:r-x
default:mask:rwx
default:other:r-x

$ getfacl sub1/sub2
# file: sub1/sub2
# owner: tomq
# group: Domain Users
user::rwx
group::r-x
group:SYSTEM:rwx
group:Administrators:rwx
group:Users:r-x
mask:rwx
other:r-x
default:user::rwx
default:group::r-x
default:other:r-x

$ getfacl hello.txt
# file: hello.txt
# owner: tomq
# group: Domain Users
user::---
group::---
group:SYSTEM:rwx
group:Administrators:rwx
group:Users:r-x
mask:rwx
other:---

$ getfacl sub1/sub2/hello.txt
# file: sub1/sub2/hello.txt
# owner: tomq
# group: Domain Users
user::---
group::---
mask:rwx
other:---


So on one level I understand what's going on, but my question is what do I do about this. 
I haven't done anything strange in my windows setup, and all my files started out with just having Windows permissions that inherited from C:\, and the fundamental issue seems to be that the basic permissions on c:\ are ---------:
$ getfacl /cygdrive/c
# file: /cygdrive/c
# owner: ????????
# group: ????????
user::---
group::---
group:SYSTEM:rwx
group:Administrators:rwx
group:Users:r-x
mask:rwx
other:---
default:user::---
default:group::---
default:group:SYSTEM:rwx
default:group:Administrators:rwx
default:group:Users:r-x
default:mask:rwx
default:other:---

icacls on the directory give me:
c:\work\cygtest BUILTIN\Administrators:(I)(F)
                BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
                NT AUTHORITY\SYSTEM:(I)(F)
                NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
                BUILTIN\Users:(I)(OI)(CI)(RX)
                NT AUTHORITY\Authenticated Users:(I)(M)
                NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)

Now I can "fix" this by just doing a chmod -R 755 or some such, but this seems so be papering over the real issue.
Do I expect the permissions on the root of my C drive to just be ---------?
Have I set up Cygwin wrong, or rather missed a set up step?

Any help would be appreciated on this.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]