“错误的解释器:权限被拒绝”如何防止此错误?

Yud*_*ira 5 centos shell python

我想直接运行程序,例如./program无需先在 shell 中定义解释器。那么,我怎样才能防止这个错误呢?

错误的解释器:权限被拒绝

我的操作系统是 redhat - CentOS 5.6 版(最终版)

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]#
Run Code Online (Sandbox Code Playgroud)

phi*_*hag 9

您正在尝试从安装了该noexec选项(可能为/tmp)的分区执行程序。将它们移动到使用exec权限挂载的目录或使用

mount -o remount,exec /tmp
Run Code Online (Sandbox Code Playgroud)

(以 root 身份)允许程序在/tmp. 您可以通过noexec/etc/fstabinit 脚本中删除选项来使此行为持久化。