(13)权限被拒绝:访问/cgi-bin/test.cgi否认((13)Permission den

2019-08-22 22:54发布

我的第一次,但没有成功尝试CGI的脚本。 我看过很多教程,随后在不同的论坛可能的线程,但我不能使它发挥作用。 我使用的是Fedora 10的机器上appache Web服务器。 我总是有问题

[Wed Oct 21 20:47:36 2009] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Wed Oct 21 20:47:36 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Oct 21 20:47:36 2009] [notice] Digest: generating secret for digest authentication ...
[Wed Oct 21 20:47:36 2009] [notice] Digest: done
[Wed Oct 21 20:47:36 2009] [notice] Apache/2.2.11 (Unix) DAV/2 PHP/5.2.9 mod_ssl/2.2.11 OpenSSL/0.9.8g configured -- resuming normal operations

我需要帮助。 这是我的环境是什么样子。

uname -a
Linux localhost.localdomain 2.6.27.5-117.fc10.i686 #1 SMP Tue Nov 18 12:19:59 EST 2008 i686 i686 i386 GNU/Linux

ls -l /var/www/cgi-bin/
total 36
-rwxrwxrwx 1 root root   106 2009-10-21 18:29 index.html
-rwxr-xr-x 1 root root 11089 2009-02-24 20:11 squidGuard.cgi
-rwxr-xr-x 1 root root  5720 2009-02-24 20:11 squidGuard-simple.cgi
-rwxr-xr-x 1 root root  5945 2009-02-24 20:11 squidGuard-simple-de.cgi
-rwxrwxrwx 1 root root   110 2009-10-21 17:38 test.cgi

apachectl -v
Server version: Apache/2.2.11 (Unix)
Server built:   Mar  6 2009 09:12:25

perl -version
This is perl, v5.10.0 built for i386-linux-thread-multi
Copyright 1987-2007, Larry Wall

我的脚本

cat test.cgi
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "Hello, world!\n";

该错误消息我创,当我尝试访问该网页服务器“ http://192.168.50.29/cgi-bin/test.cgi ”看起来是这样的:

[Wed Oct 21 21:00:27 2009] [error] [client 192.168.50.69] (13)Permission denied: access to /cgi-bin/test.cgi denied

我已经添加了一行:

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

到/etc/httpd/conf/httpd.conf中

我不能使它发挥作用。 谁能帮我?

Answer 1:

检查你的操作系统权限test.cgi,并确保您使用的是运行的Apache已经阅读权限的用户或组。

编辑 - 问题是与权限,但不具有读取权限,因为你正在使用SELinux的,你不用担心你的文件内容。 勾选此线程在Fedora的论坛,它解释了相当多的选项,以解决您的问题。



Answer 2:

1。 首先检查了httpd.conf FILE.Set脚本目录在httpd.conf如下。
在这里你需要确保你找到合适的httpd.conf file.For例如,在我的Debian的默认的httpd.conf文件是/ etc / apache2的/网站-avaialbe /默认。

<Directory "dir_name">
    Options All
    AllowOverride All
    Order allow,deny
    Allow from all
<Directory>

或者你可以只使用默认的/ cgi-bin文件夹。

2 .SET的测试脚本执行权限

chmod +x script_name


Answer 3:

检查你的fstab文件,如果安装的文件系统有权限执行

UUID=xxx-xxx-xxx-xx-xx     /mnt/mountpoint     ext4     rw,user,exec      0      0

EXEC部分是很重要的



Answer 4:

SELinux的防止阿帕奇从我的情况下访问CGI脚本。 为我工作的快速正肮脏的修复程序关闭SELinux的:

vim /etc/sysconfig/selinux
set "SELINUX=disabled"
reboot


文章来源: (13)Permission denied: access to /cgi-bin/test.cgi denied
标签: linux apache