我遇到了调用perl和shell脚本的PHP接口的问题。 这些function可以将file upload到一个文件夹,并在一些input中执行它们,同时将输出存储到其他文件中。 现在看来,我可以给读写访问或执行使用下列之一:
chcon -Rv --type=httpd_sys_rw_content_t user_dir/ chcon -Rv --type=httpd_fastcgi_script_exec_t user_dir/
我怎样才能recursion启用文件夹具有读写和执行权限?
从我可以告诉,默认的httpd的selinux策略不支持创build可执行文件(在那里没有意外)。
你有几个选项,不涉及禁用selinux,(1)自定义默认策略/创build自己的或(2)改变httpd运行没有selinux保护。
如果您想要做(2),请运行以下命令:
# chcon -t unconfined_exec_t /usr/sbin/httpd # /etc/init.d/httpd restart
这将导致httpd在unconfined域中运行,只会受到正常的unix rwx权限的影响。
要将httpd还原为默认的目标策略,请使用'restorecon':
# restorecon -F /usr/sbin/httpd # /etc/init.d/httpd restart