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: chmod works only for cygwin processes


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Magnus Svensson wrote:
> Hi,
> 
> I'm experiencing a problem that a file that I make "chmod -r" on from a
> perl script(or manually as you can see below) is readable from a windows
> process. I.e the chmod seems to work only for the cygwin programs.
> 
> Here is what I do to reproduce it:
> 
> # Create a test directory
> mysqldev@win2003-x86:~> mkdir test
> mysqldev@win2003-x86:~> cd test
> mysqldev@win2003-x86:~/test> mkdir testdir
> mysqldev@win2003-x86:~/test> ls -l
> total 0
> drwxrwxrwx+ 2 mysqldev None 0 May  4 13:44 testdir
> 
> # Remove read access from the directory
> mysqldev@win2003-x86:~/test> chmod -r testdir
> mysqldev@win2003-x86:~/test> ls -l
> total 0
> d-wx-wx-wx+ 2 mysqldev None 0 May  4 13:44 testdir
> mysqldev@win2003-x86:~/test> ls -l testdir
> ls: testdir: Permission denied
> 
> # Now I pipe "dir test" to windows cmd.exe and it can read it.
> mysqldev@win2003-x86:~/test> echo 'dir testdir' | cmd.exe;
> Microsoft Windows [Version 5.2.3790]
> (C) Copyright 1985-2003 Microsoft Corp.
> 
> C:\cygwin\home\mysqldev\test>dir testdir
>  Volume in drive C has no label.
>  Volume Serial Number is 749A-DF8B
> 
>  Directory of C:\cygwin\home\mysqldev\test\testdir
> 
> 05/04/2006  01:44 PM    <DIR>          .
> 05/04/2006  01:44 PM    <DIR>          ..
>                0 File(s)              0 bytes
>                2 Dir(s)  12,312,645,632 bytes free
> 
> # cleanup
> mysqldev@win2003-x86:~/test> chmod +r testdir
> mysqldev@win2003-x86:~/test> cd ..
> mysqldev@win2003-x86:~> rm -rf test
> 
> 
> 
> Please advice what I can do or try?
> 
> 
> Attaching the above steps as a small script as well as the output from
> cygcheck -srv.
> 
> 

I tried to duplicate here but was unable to do so.  I created a folder
named test and tried setting different permissions on it.  It worked as
expected.  Here are the test cases I did and as you can see I was pretty
thorough although I didn't try every possible combination.  All test
cases were done on Windows XP Pro SP2.  Sorry I don't have a Windows
2003 box to make an absolute verification.  This might be a bug with
Windows 2003 if someone else can reproduce.  As far as I can tell though
the ACLs are being set correctly.  The security tab in Windows XP Pro
reflected special permissions correctly.

Reading involved using the command 'type' from the cmd.exe and 'cat'
from cygwin.  Writing involved using 'echo' in both cmd.exe and cygwin.
 I used 'dir' in cmd.exe and 'ls' in cygwin for directory listing checks.

chmod 0000 no permission (inaccessable even to owner / only chmod
possible) (worked in both cygwin and cmd)
chmod 0111 execute permission -- can change to folder but no directory
listing (worked in both cygwin and cmd)
chmod 0222 write permission (worked in both cygwin and cmd)
chmod 0333 write/execute permission -- no directory listing (worked in
both cygwin and cmd)
chmod 0444 read permission -- cannot change to directory for listing but
can get one directly (worked in both cygwin and cmd)
chmod 0555 read/execute permission (worked in both cygwin and cmd)
chmod 0666 read/write permission --  cannot change to directory for
listing but can get one directly (worked in both cygwin and cmd)
chmod 0777 full access (worked in both cygwin and cmd)

And of course all behavior was verified correct against both netbsd an
centos linux distro.

Windows behavior equivelent
"Permission denied" in linux is equal to "Access denied" in windows when
trying to do a change to a directory, read, or write a file.
"Permission denied" in linux is equal to "File Not Found" in windows
when trying to do a directory listing.

- --
Robert Pendell
shinji257@uplink.net

Thawte Web of Trust Notary
CAcert Assurer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)

iD8DBQFEXM5ENqnRaBCOmrYRAilLAJ91RqRtW6XQBEGXBwL/OgMiwif+7wCgp2nq
j08qVZOUNt1YaHJUdKT+cHs=
=qXiT
-----END PGP SIGNATURE-----


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


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