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: Turning off execute permission

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:
>> on the execute permissions. ÂDid I read that it was impossible to deny
>> execute permissions?? ÂIn my tests, the follow is always "true" if a
>> file has no execute permissions: (mode 666 or 000)
>> Â[ -x apachectl ]
>> Âtest -x apachectl
>> for all of the shells
> Are you operating as an administrator? ÂJust as in Linux, the superuser
> 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
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
mastermind:/tmp# test -w foo && echo yep || echo nope
mastermind:/tmp# test -x foo && echo yep || echo nope
mastermind:/tmp# ./foo
bash: ./foo: Permission denied
mastermind:/tmp# sh foo

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


Unsubscribe info:
Problem reports:

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