delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/03/20/15:05:31

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=oBLPbayBlQBlI+pA
q+e3DtaL2N9WMaEQAC4LimfmQAaEEPNuCWzLTT+64e4s2pd5c/7lJ6zRwq08RMPO
9h3xPdAyoDNzQ3NQxfg7KbDoADxrRs4qYtt9y6JlBiKBVND9maw7WKTuClennKjU
QtA8aOQANem0hOShcqs47RrgF2g=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=H0flmKdVnwngTlRXz+1daK
7WwNo=; b=NX3ugnvPtORGYqAXMOyFC5GJXJfenxrPLnX1nGTj0pIxpY0nv+HnMP
NQ4XRiDcAPRs9uS0Pm76umdONCssV/tZlflgAPTP2rQ8LEX+ULLgfdwrBlyMnMBU
F2q8n8SjVrRXLDG5PPGnmf69rewv2nV/YLoxQSw3dHGM7GTGpkkQs=
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-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_THEBAT,SPF_SOFTFAIL,TW_YG autolearn=no version=3.3.1
Date: Wed, 20 Mar 2013 23:01:16 +0400
From: Andrey Repin <anrdaemon AT freemail DOT ru>
Reply-To: Andrey Repin <cygwin AT cygwin DOT com>
Message-ID: <318418716.20130320230116@mtu-net.ru>
To: pfx <pf DOT prologue AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: windows 7 : files permission problem
In-Reply-To: <5149E9FF.6090409@gmail.com>
References: <5149E9FF DOT 6090409 AT gmail DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, pfx!

> Hi,

> when I use 'cp -R' to copy files, I can't access to the target file (I 
> have no permission on the target files)

> I reproduce this problem with a fresh install of windows 7 and cygwin
> my account is a user account (not admin)

> from a DOS box, I create c:\test\d1\d2\test.txt

C:\>>md test
C:\>>cd test
C:\test>>md d1
C:\test>>md d1\d2
C:\test>>echo test > d1\d2\test.txt

> from the cygwin console

> $ cd /cygdrive/c/test/
> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ ll
> total 0
> d---------+ 1 patrick None 0 Mar 20 17:18 d1
> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ ll d1/
> total 0
> d---------+ 1 patrick None 0 Mar 20 17:18 d2
> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ ll d1/d2/
> total 1
> ----------+ 1 patrick None 7 Mar 20 17:18 test.txt

> #
> # Why cygwin doesn't display posix permissions ?
> #

Because the ACL set on the file do not match any POSIX permissions. The
presence of extended attributes (like ACL) is indicated by "+" at the end of
POSIX permission byte.

> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ cat d1/d2/test.txt
> test

> #
> # I have no permission on d1/d2/test.txt, but I can 'CAT' it
> #

Oh, indeed, you DO have permissions. Else you would not be able to cat it.

> #
> # now, I copy the ./d1/* to ./win
> #
> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ mkdir sub

> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ cp -R d1/* sub/

> #
> # no more posix file permission
> #
> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ ll sub/
> total 0
> d---------+ 1 patrick None 0 Mar 20 17:21 d2

> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ ll sub/d2/
> total 1
> ---------- 1 patrick None 7 Mar 20 17:21 test.txt

And here is the fine, that have no permissions set whatsoever.

> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ cat sub/d2/test.txt
> cat: sub/d2/test.txt: Permission denied
> #
> # but now I can acces the file from cygwin
> #

Doesn't looks like so...

> I return to the DOS box

C:\test>>type sub\d2\test.txt
> Access is denied.

> I can't read the file from windows

You can't read it from both places. At least, not until you launch either
console from a superadmin account. And stop referring to console as "DOS box",
that's just wrong.

> Of course, I have no problem with cygwin with my XP computer

> Any idea ?

As a general rule, if you are going to mix Cygwin and native tools, let
windows handle file permissions ("noacl" mount option), and you'll not see
such issues again.

> more tech info :

> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ getfacl.exe .
> # file: .
> # owner: patrick
> # group: None
> user::---
> group::---
> group:root:rwx
> group:SYSTEM:rwx
> group:Users:r-x
> mask:rwx
> other:---
> default:user::---
> default:group::---
> default:group:root:rwx
> default:group:SYSTEM:rwx
> default:group:Users:r-x
> default:mask:rwx
> default:other:---


> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ getfacl.exe d1/d2/test.txt
> # file: d1/d2/test.txt
> # owner: patrick
> # group: None
> user::---
> group::---
> group:root:rwx
> group:SYSTEM:rwx
> group:Users:r-x
> mask:rwx
> other:---


> patrick AT WIN-K396JDQPSD0 /cygdrive/c/test
> $ getfacl.exe sub/d2/test.txt
> # file: sub/d2/test.txt
> # owner: patrick
> # group: None
> user::---
> group::---
> mask:rwx
> other:---


> $ cygcheck -s
> [...]
> Windows 7 Home Basic N Ver 6.1 Build 7601 Service Pack 1
> Running under WOW64 on AMD64
> [...]
> Output from C:\dev\cygwin\bin\id.exe
> UID: 1005(patrick) GID: 513(None)
> 513(None)          545(Users)
> [...]
>      Cygwin DLL version info:
>          DLL version: 1.7.17


> --
> 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



--
WBR,
Andrey Repin (anrdaemon AT freemail DOT ru) 20.03.2013, <22:53>

Sorry for my terrible english...


--
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