|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
(13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed
Hi,
I am tryning out CGI-scripts for the first time but without success. I have read many tutorials and followed may threads in different forums but I can not make it work. I am using a appache web server on a Suse 10 machine. I always have problem with (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed. I need help. This is what my environment looks like. uname -a Linux linux 2.6.13-15.8-smp #1 SMP Tue Feb 7 11:07:24 UTC 2006 i686 i686 i386 GNU/Linux apache2ctl -v Server version: Apache/2.0.54 Server built: Sep 9 2005 18:32:43 which perl /usr/bin/perl perl -version This is perl, v5.8.7 built for i586-linux-thread-multi (with 1 registered patch, see perl -V for more detail) ls -l /srv/www total 2 drwxr-xr-x 6 root root 144 2006-03-10 12:47 . drwxr-xr-x 4 root root 96 2005-09-09 18:27 .. drwxr-xr-x 3 root root 240 2006-03-10 12:38 cgi-bin drwxr-xr-x 4 root root 128 2005-11-25 21:51 htdig drwxr-xr-x 6 root root 1640 2006-03-10 12:47 htdocs drwxr-xr-x 2 root root 48 2005-09-09 20:55 perl-lib linux:/srv/www/cgi-bin # ls -l /srv/www/cgi-bin/ total 196 drwxr-xr-x 3 root root 240 2006-03-10 12:38 . drwxr-xr-x 6 root root 144 2006-03-10 12:47 .. -rwxrwxrwx 1 matajaz users 78 2006-03-10 12:39 first.cgi My script cat first.cgi #!/usr/bin/perl print "Content-Type: text/htmlnn"; print "Hello, world!n"; The error message I gen when I try to access the web page "http://localhost/cgi-bin/first.cgi" looks like this: /var/log/apache2/access_log <== ::1 - - [10/Mar/2006:13:08:20 +0100] "GET /cgi-bin/first.cgi HTTP/1.1" 500 1064 "-" "Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.2 (like Gecko)" ==> /var/log/apache2/error_log <== [Fri Mar 10 13:08:20 2006] [error] [client ::1] (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed [Fri Mar 10 13:08:20 2006] [error] [client ::1] Premature end of script headers: first.cgi I have added the line: ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/" to /etc/apache2/http.conf I just can not make it work. Can anyone help me? Br Matajaz |
|
#2
|
|||
|
|||
|
RE: (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed
Did anyone ever find a solution to this problem?
I have the identical issue. |
|
#3
|
|||
|
|||
|
RE: (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed
I gave up.
I think I had tried everything a couple of times, even reinstallation of web server. I decided to make a backup of my important files and made a complete new installation of Suse including the Appache web services. I copied my old cgi scripts back to the /srv/www/cgi-bin/ and did chown wwwrun * and chgrp www *. I enabled the webserver after this and everything was running as expected. I guess my installation of Suse/appache was not ok earier (do not know why). |
|
#4
|
|||
|
|||
|
RE: (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed
I am also running into this same issue, I believe it to be related to suexec not being properly configured. I have rebuilt Apache 2 from source RPM and changed some of the parameters for suexec to try and get it working. This is what I've got so far:
[root@host01 logs]# suexec -V -D AP_DOC_ROOT="/home" -D AP_GID_MIN=5 -D AP_HTTPD_USER="apache" -D AP_LOG_EXEC="/var/log/httpd/suexec.log" -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin" -D AP_UID_MIN=5 -D AP_USERDIR_SUFFIX="public_html" I changed the UID_MIN to 5, because I was getting this error in the suexec log... [2006-04-10 20:42:32]: crit: invalid uid: (48) 48 is the UID of apache, so my guess is the script is trying to run as apache, when it should su to the owner (501), and reaching an error. When I disabled suexec by running: chmod u-s /usr/sbin/suexec I started getting the same error as you. I suspect if apache and suexec are built right you should just need to: chmod 4510 /usr/sbin/suexec |
|
#5
|
|||
|
|||
|
RE: RE: (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed
Quote:
I am having the same diff. Trying to set up nagios. I have tried to do every thing mentioned above. Please help??? |
|
#6
|
|||
|
|||
|
RE: RE: (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed
Quote:
I am having the same diff. Trying to set up nagios. I have tried to do every thing mentioned above. Please help??? |
|
#7
|
|||
|
|||
|
RE: (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed
I am having the same diff. Trying to set up nagios. I have tried to do every thing mentioned above. Please help???
|
|
#8
|
|||
|
|||
|
I had the same problem, I was running a Red Hat based distro. All I had to do was disable the SELinux.
|
|
#9
|
|||
|
|||
|
Quote:
You don't have to disable SELinux completely, but just change the SELinux context of the cgi-bin directory. Before changing contexts (when cgi scripts failed to execute), the SELinux contexts looked like this Code:
ls -Zld /var/www/cgi-bin /usr/local/linuxcoe-sd/cgi-bin/ drwxr-xr-x 2 root:object_r:usr_t root root 4096 Jun 12 12:55 /usr/local/linuxcoe-sd/cgi-bin/ drwxr-xr-x 2 system_u:object_r:httpd_sys_script_exec_t root root 4096 Feb 28 2005 /var/www/cgi-bin I changed the SELinux context of /usr/local/linuxcoe-sd/cgi-bin/ to allow script execution with the following command Code:
chcon --reference=/var/www/cgi-bin -R /usr/local/linuxcoe-sd/cgi-bin To vefify the SELinux context change run, Code:
ls -Zld /var/www/cgi-bin /usr/local/linuxcoe-sd/cgi-bin/ drwxr-xr-x 2 system_u:object_r:httpd_sys_script_exec_t root root 4096 Jun 12 12:55 /usr/local/linuxcoe-sd/cgi-bin/ drwxr-xr-x 2 system_u:object_r:httpd_sys_script_exec_t root root 4096 Feb 28 2005 /var/www/cgi-bin - Praveen |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|