I chmod 777'ed an executable and trying to execute it like this: /home/gandalf/./sample but it doesn't work /bin/bash: line 25: ./sample: Permission denied What can be the problem? Thanks.
4 Answers
Seems like ./sample
is a wrapper script for something else, and is calling another script/program on line 25 that you do not have execute permissions to.
I would try to cat ./sample
to see what is on (or around) line 25 that it would be calling.
If you don't understand what is going on, you can post the contents of the script in your question and we'll help you out.
-
sample is not a script, it is a binary file..– Salina OdelvaApr 2, 2010 at 19:21
-
When I type "set" command: TERM=dumb GATEWAY_INTERFACE=CGI/1.1– Salina OdelvaApr 2, 2010 at 19:23
When you type file sample
what is the result?
Note that it could be that your file system is mounted noexec
to stop you executing files from your home directory.
Maybe your binary file is :
system("/script/on/which/you/have/no/permission");
or
exec("/script/on/which/you/have/no/permission");
As Marcel said, probably there is a exec
call to another executable. Try run it with strace
, and you should find that out, i.e.:
$ strace a.out|grep exec
...snip...
execve("/bin/ls", ["ls"], [/* 37 vars */]) = 0
...snip...
file sample
? it doesn't look like binary.