Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Are you actually trying to run this from the console or through a terminal like putty? Your TERM that you mentioned in your comment suggests you are using some kind of web gateway. It is possible your web gateway is causing problems, and the application just will not be able to work in that environment. – Zoredache Apr 2 '10 at 19:37
can you run this command file sample? it doesn't look like binary. – rytis Apr 2 '10 at 19:55
There are many things that can interfere with trying to execute a file. We're going to need a bit more background in order to give an answer. – Ignacio Vazquez-Abrams Apr 2 '10 at 20:21
Generally, you shouldn't set the permissions of a file to 777. Normally 775 is as far as you should go. – Dennis Williamson Apr 2 '10 at 21:09

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.

share|improve this answer

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.

share|improve this answer
sample is not a script, it is a binary file.. – Salina Odelva Apr 2 '10 at 19:21
When I type "set" command: TERM=dumb GATEWAY_INTERFACE=CGI/1.1 – Salina Odelva Apr 2 '10 at 19:23

Maybe your binary file is :



share|improve this answer

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
execve("/bin/ls", ["ls"], [/* 37 vars */]) = 0
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.