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'm very befuddled by this error and don't even know what to google for:

Failure - Executing a script with:

bash: ./ "Permission denied" 

Works - while these apporeaches work:

sh ./
bash ./

The test script:


echo "Works"

With all execute rights:

chmod 777

ls -als 
4 -rwxrwxrwx 1 edo edo 27 13. Feb 10:41

I'm quite clueless to why this is happening as it doesn't make any sense to me and I have no clue what words to Google for to properly describe the behavior..

share|improve this question
Results for mount -v? – Bart De Vos Feb 13 '12 at 9:56
up vote 6 down vote accepted

Executing a script by depending on the shebang line works quite differently from passing it as the argument to a shell.

In the former case, the file must reside on an executable partition, and must contain a valid shebang line to an existing shell.

In the latter case, none of that is necessary, as the shell you're calling the script with takes responsibility for these things.

NOTE that you're not using the same shell for these tests either: the first infers bash, while the second uses sh.

My guess is that the partition your script resides on does not allow execution; mount -v will tell you if this is the case.

share|improve this answer
Right on the money: /dev/sda4 on $path type ext2 (rw,nosuid,nodev,noexec,relatime,user_xattr,acl,barrier=1) - I'll accept it once I'm allowed to (timeout). Thanks! – edorian Feb 13 '12 at 9:57

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.