当前位置: 代码迷 >> CGI >> linux支持CGI有关问题
  详细解决方案

linux支持CGI有关问题

热度:470   发布时间:2012-03-01 10:25:47.0
linux支持CGI问题
我的系统是8.10,系统中有完好的LAMP环境,现在想运行CGI程序,设置了配置文件(别名),安装了perl5.10.0,可是访问cgi的文件夹时候老是报:You don't have permission to access /cgi-bin/ on this server. 我已经把cgi的权限和文件夹的权限设置成了755.不知道是什么原因,有谁能帮帮我?

------解决方案--------------------
1 路径里面是否有软连接,
2 全路径是什么,是否有可能这样的情况 :最后的目录有权限,但靠前的目录,没权限。
------解决方案--------------------
路径可能错了,只要写虚拟路径就可以
或者就是你的CGI程序没有放到/cgi-bin这个目录下
------解决方案--------------------
关注中!!!遇到同样问题。
------解决方案--------------------
系统警告如下:


摘要:

SELinux is preventing the httpd from using potentially mislabeled files
(./cgi-bin).

详细的描述:

[SELinux is in permissive mode, the operation would have been denied but was
permitted due to permissive mode.]

SELinux has denied httpd access to potentially mislabeled file(s) (./cgi-bin).
This means that SELinux will not allow httpd to use these files. It is common
for users to edit files in their home directory or tmp directories and then move
(mv) them to system directories. The problem is that the files end up with the
wrong file context which confined applications are not allowed to access.

正在允许访问:

If you want httpd to access this files, you need to relabel them using
restorecon -v './cgi-bin'. You might want to relabel the entire directory using
restorecon -R -v './cgi-bin'.

附加的信息:

源上下文 system_u:system_r:httpd_t
目标上下文 system_u:object_r:user_home_t
目标对象 ./cgi-bin [ dir ]
Source httpd
Source Path /usr/sbin/httpd
Port <未知的>
Host sht
Source RPM Packages httpd-2.2.3-22.el5
Target RPM Packages
策略 RPM selinux-policy-2.4.6-203.el5
Selinux 激活 True
策略类型 targeted
MLS 激活 True
强制模式 Permissive
插件名称 home_tmp_bad_labels
主机名 sht
平台 Linux sht 2.6.18-128.el5xen #1 SMP Wed Dec 17
12:22:24 EST 2008 i686 i686
警告记数 9
First Seen 2009年05月08日 星期五 09时40分29秒
Last Seen 2009年05月08日 星期五 11时08分45秒
Local ID c2e97aaf-c5e5-4c83-b42d-0af22380cad8
行数

原始 Audit 消息

host=sht type=AVC msg=audit(1241752125.593:14): avc: denied { search } for pid=2801 comm="httpd" name="cgi-bin" dev=dm-0 ino=3145919 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=dir

host=sht type=SYSCALL msg=audit(1241752125.593:14): arch=40000003 syscall=195 success=yes exit=0 a0=96b50c0 a1=bfdd1dbc a2=5cdff4 a3=8170 items=0 ppid=2760 pid=2801 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)