www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/07/16:44:44

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <49B29464.4090507@byu.net>
References: <49B22717 DOT 5020508 AT columbus DOT rr DOT com> <49B29464 DOT 4090507 AT byu DOT net>
Date: Sat, 7 Mar 2009 16:44:30 -0500
Message-ID: <17393e3e0903071344k528a5dc0h86275fa94cdd506@mail.gmail.com>
Subject: Re: Turning off execute permission
From: Matt Wozniski <godlygeek AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

On Sat, Mar 7, 2009 at 10:36 AM, Eric Blake wrote:
> According to Paul McFerrin on 3/7/2009 12:49 AM:
>>
>> I've been reading:
>> http://cygwin.com/1.7/cygwin-ug-net/ntsec.html#ntsec-files
>> on the execute permissions. =C2=A0Did I read that it was impossible to d=
eny
>> execute permissions?? =C2=A0In my tests, the follow is always "true" if a
>> file has no execute permissions: (mode 666 or 000)
>> =C2=A0[ -x apachectl ]
>> =C2=A0test -x apachectl
>> for all of the shells
>
> Are you operating as an administrator? =C2=A0Just as in Linux, the superu=
ser
> has the privilege of executing any file regardless of its permissions.
> test -x uses access() and not stat() to determine the answer of whether
> the file is executable for the currently logged on user, so this is
> accurately reporting what you are able to do with the file, regardless of
> what the permission bits are on the file.

Hm.  Is this really the right behavior?  This is what I see on Linux:

mastermind:/tmp# cat foo
#!/bin/sh
echo $0
mastermind:/tmp# ls -l foo
---------- 1 matt matt 0 2009-03-07 16:24 foo
mastermind:/tmp# test -r foo && echo yep || echo nope
yep
mastermind:/tmp# test -w foo && echo yep || echo nope
yep
mastermind:/tmp# test -x foo && echo yep || echo nope
nope
mastermind:/tmp# ./foo
bash: ./foo: Permission denied
mastermind:/tmp# sh foo
foo

It seems not to behave this way on Linux, though the read and write
tests always succeed for root.

~Matt

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