Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to run program directly such as ./program without define the interpreter in shell first. so, how can i want to prevent this error?

bad interpreter: Permission denied

My operating system is redhat - CentOS release 5.6 (Final)

root@server [/tmp/mechanize-0.1.7b]# ./functional_tests.py 
-bash: ./functional_tests.py: /usr/bin/env: bad interpreter: Permission denied
root@server [/tmp/mechanize-0.1.7b]#
root@server [/tmp/Python-2.7.1]# ./configure 
-bash: ./configure: /bin/sh: bad interpreter: Permission denied
root@server [/tmp/Python-2.7.1]#
share|improve this question

migrated from stackoverflow.com May 21 '11 at 18:47

This question came from our site for professional and enthusiast programmers.

    
Odd. Off-topic, but ... "have" /bin/sh and it is +x'ed? –  pst May 21 '11 at 18:46

2 Answers 2

up vote 9 down vote accepted

You're trying to execute programs from a partition mounted with the noexec option (likely /tmp). Either move them to a directory that is mounted with exec rights or use

mount -o remount,exec /tmp

(as root) to allow programs to be executed on /tmp. You can make this behavior persistent by removing the noexec option from /etc/fstab or your init scripts.

share|improve this answer
    
still not work root@server [/tmp/Python-2.7.1]# mount -o remount,exec /tmp root@server [/tmp/Python-2.7.1]# ./configure -bash: ./configure: /bin/sh: bad interpreter: Permission denied root@server [/tmp/Python-2.7.1]# –  Gunslinger_ May 21 '11 at 19:32
    
@Gunslinger_ / could be mounted noexec, too. Can you give us the outputs of mount and ls -l /bin/sh? –  phihag May 21 '11 at 19:50

Long-shot, but make sure that /tmp isn't mounted with the noexec mount option. That can give errors like that.

share|improve this answer

Your Answer

 
discard

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.