delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/05/06/12:27:17

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Robert Pendell <shinji257 AT uplink DOT net>
Subject: Re: chmod works only for cygwin processes
Date: Sat, 06 May 2006 12:26:44 -0400
Lines: 109
Message-ID: <e3iins$rmi$1@sea.gmane.org>
References: <4459ED69 DOT 3010508 AT mysql DOT com>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060308 Thunderbird/1.5.0.2 Mnenhy/0.7.4.0
In-Reply-To: <4459ED69.3010508@mysql.com>
OpenPGP: id=108E9AB6
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

-----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 AT win2003-x86:~> mkdir test
> mysqldev AT win2003-x86:~> cd test
> mysqldev AT win2003-x86:~/test> mkdir testdir
> mysqldev AT win2003-x86:~/test> ls -l
> total 0
> drwxrwxrwx+ 2 mysqldev None 0 May  4 13:44 testdir
> 
> # Remove read access from the directory
> mysqldev AT win2003-x86:~/test> chmod -r testdir
> mysqldev AT win2003-x86:~/test> ls -l
> total 0
> d-wx-wx-wx+ 2 mysqldev None 0 May  4 13:44 testdir
> mysqldev AT 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 AT 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 AT win2003-x86:~/test> chmod +r testdir
> mysqldev AT win2003-x86:~/test> cd ..
> mysqldev AT 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 AT uplink DOT 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/

- Raw text -


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