delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/02/15/12:10:03

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,TW_MK
X-Spam-Check-By: sourceware.org
X-SpamScore: 0
X-BigFish: VPS0(zzzz1202hzzz2dh2a8h668h839h944h)
X-Forefront-Antispam-Report: CIP:157.55.224.141;KIP:(null);UIP:(null);IPV:NLI;H:DB3PRD0502HT010.eurprd05.prod.outlook.com;RD:none;EFVD:NLI
From: Tom Quarendon <tom DOT quarendon AT teamwpc DOT co DOT uk>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: File permissions problems with cp in Windows 7
Date: Wed, 15 Feb 2012 17:09:25 +0000
Message-ID: <E1936B3CBF336B4D93C1B2F74E37126804981A@DB3PRD0502MB101.eurprd05.prod.outlook.com>
MIME-Version: 1.0
X-OriginatorOrg: teamwpc.co.uk
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q1FH9wwu017551

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 AT spot /cygdrive/c/work/cygtest
$ cat hello.txt
tom
tomq AT 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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019