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]

Re: windows 7 : files permission problem


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@WIN-K396JDQPSD0 /cygdrive/c/test
> $ ll
> total 0
> d---------+ 1 patrick None 0 Mar 20 17:18 d1
> patrick@WIN-K396JDQPSD0 /cygdrive/c/test
> $ ll d1/
> total 0
> d---------+ 1 patrick None 0 Mar 20 17:18 d2
> patrick@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@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@WIN-K396JDQPSD0 /cygdrive/c/test
> $ mkdir sub

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

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

> patrick@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@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@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@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@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@freemail.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


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