This is the mail archive of the
cygwin
mailing list for the Cygwin project.
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:
>> http://cygwin.com/1.7/cygwin-ug-net/ntsec.html#ntsec-files
>> 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
#!/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/