Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsOther TechnologiesServer Administration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 4 votes, 3.50 average. Display Modes
 
Unread Codewalkers Forums Sponsor:
Old March 10th, 2006, 11:30 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,308 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 33
(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

Reply With Quote
Old April 7th, 2006, 08:16 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,308 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 33
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.

Reply With Quote
Old April 9th, 2006, 03:24 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,308 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 33
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).


Reply With Quote
Old April 11th, 2006, 03:03 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,308 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 33
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

Reply With Quote
Old November 8th, 2006, 09:06 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,308 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 33
RE: RE: (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed


Quote:
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


I am having the same diff. Trying to set up nagios. I have tried to do every thing mentioned above. Please help???

Reply With Quote
Old November 8th, 2006, 09:06 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,308 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 33
RE: RE: (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed


Quote:
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


I am having the same diff. Trying to set up nagios. I have tried to do every thing mentioned above. Please help???

Reply With Quote
Old November 8th, 2006, 09:08 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,308 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 33
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???

Reply With Quote
Old May 5th, 2009, 07:54 PM
eric01 eric01 is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 1 eric01 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 24 sec
Reputation Power: 0
I had the same problem, I was running a Red Hat based distro. All I had to do was disable the SELinux.
Comments on this post
gnupravi agrees: It pointed me in the right direction

Reply With Quote
Old June 12th, 2009, 04:10 PM
gnupravi gnupravi is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 1 gnupravi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 11 sec
Reputation Power: 0
Quote:
Originally Posted by eric01
I had the same problem, I was running a Red Hat based distro. All I had to do was disable the SELinux.


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

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesServer Administration > (13)Permission denied: exec of '/srv/www/cgi-bin/first.cgi' failed


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap