LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-26-2006, 05:09 AM   #1
noir911
Member
 
Registered: Apr 2004
Posts: 682

Rep: Reputation: Disabled
nagios cgi-bin permission error


I am running Nagios version 2.0b4 with Apache 1.3.29 on OpenBSD 3.8.

Everytime I try to go to my http://website/nagios/cgi-bin it gives error -

Error 403
Forbidden
You don't have permission to access /nagios/cgi-bin/ on this server

However, http://website/nagios/ works fine!

Apache access_log shows -

nagiosadmin [26/May/2006:19:46:33 +1000] "GET /nagios/cgi-bin/this .txt HTTP/1.1" 403 293

Apache error_log shows -

[Fri May 26 19:46:33 2006] [error] [client 203.13.45.66] file permissions deny server execution: /myserver/nagios/cgi-bin/this.txt

Directory permission for "/var/www/mysite/nagios/cgi-bin" directory looks like this -

drwxr-xr-x 2 root daemon 512 May 26 16:51 /nagios/cgi-bin/

File permissions on "/var/www/mysite/nagios/cgi-bin" directory looks like this -

-rw-r--r-- 1 root daemon 73 May 26 16:51 .nagios_passwd
-r-xr-xr-x 1 root bin 240064 Sep 4 2005 avail.cgi
-r-xr-xr-x 1 root bin 241600 Sep 4 2005 cmd.cgi
-r-xr-xr-x 1 root bin 202848 Sep 4 2005 config.cgi
-rw-r--r-- 1 root daemon 4 May 26 16:49 this.txt

Note: "this.txt" is a file I created.

Here's my nagios part of httpd.conf

ScriptAlias /nagios/cgi-bin /var/www/mysite/nagios/cgi-bin
<Directory "/var/www/mysite/nagios/cgi-bin/">
Options ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /var/www/mysite/nagios/cgi-bin/.nagios_passwd
Require user nagiosadmin
</Directory>


Alias /nagios /var/www/mysite/nagios
<Directory "/var/www/mysite/nagios/">
Options -Indexes
Order deny,allow
Deny from all
Allow from <my IP>
AuthType Basic
AuthName "Nagios"
AuthUserFile /var/www/mysite/nagios/.nagios_passwd
Require user nagiosadmin
</Directory>

Last edited by noir911; 05-26-2006 at 05:14 AM.
 
Old 05-26-2006, 06:02 AM   #2
greeklegend
Member
 
Registered: Feb 2006
Location: At a computer
Distribution: Ubuntu 7.04, LFS 6.3 rc1 (living dangerously ;), Windows XP
Posts: 75

Rep: Reputation: 15
Can you execute scripts in this directory?
It won't be able to actually execute "this.txt"
 
Old 05-26-2006, 06:05 AM   #3
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
you have posted so much , and lo the answer is already in the question.
A simple
chmod +755 /var/www/mysite/nagios/cgi-bin/this.txt
solves the problem
 
Old 05-26-2006, 07:05 AM   #4
noir911
Member
 
Registered: Apr 2004
Posts: 682

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by greeklegend
Can you execute scripts in this directory?
It won't be able to actually execute "this.txt"
No, it can't. I have also set permission 755 to "this.txt" and it gives Internal Server Error if I go http://mysite/nagios/cgi-bin/this.txt and gives the old permission denied error if I go "http://mysite/nagios/cgi-bin/"

my /etc/nagios directory is a symlink to /var/www/etc/nagios

I did a /usr/local/sbin/nagios -v /etc/nagios/nagios.cfg & it works fine - shell exit code is 0.

Then I tried to start Nagios (/usr/local/sbin/nagios -d /etc/nagios/nagios.cfg) & it starts fine as well.

Is there any other httpd.conf directive I should look at?

Last edited by noir911; 05-26-2006 at 08:22 PM.
 
Old 05-26-2006, 11:35 PM   #5
greeklegend
Member
 
Registered: Feb 2006
Location: At a computer
Distribution: Ubuntu 7.04, LFS 6.3 rc1 (living dangerously ;), Windows XP
Posts: 75

Rep: Reputation: 15
Quote:
Originally Posted by noir911
I have also set permission 755 to "this.txt" and it gives Internal Server Error if I go http://mysite/nagios/cgi-bin/this.txt
That would be because it is looking for something to interpret this.txt with but can't find it; there is no #!/usr/bin/perl or a different script engine at the top. Try writing a perl script there and do
chmod +755 /var/www/mysite/nagios/cgi-bin/somescript.cgi
That should clear up the internal server error. I don't think apache allows anybody to list the contents of /cgi-bin/ for securty reasons; my apache dosen't and there shouldn't be a need to anyway.
 
Old 05-26-2006, 11:38 PM   #6
noir911
Member
 
Registered: Apr 2004
Posts: 682

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by greeklegend
That would be because it is looking for something to interpret this.txt with but can't find it; there is no #!/usr/bin/perl or a different script engine at the top. Try writing a perl script there and do
chmod +755 /var/www/mysite/nagios/cgi-bin/somescript.cgi
That should clear up the internal server error. I don't think apache allows anybody to list the contents of /cgi-bin/ for securty reasons; my apache dosen't and there shouldn't be a need to anyway.
I have solved this problem, somewhat. What I found is if I put the
cgi-bin in "/var/www/mysite/cgi-bin/" & point apache to read it,
nagios can read it fine. It asks for password and shows everything!

As soon as I point Apache to read "/var/www/mysite/nagios/cgi-bin" it gives the permission denied error.

This is not a biggie but does anyone know what this is happening and
how can I solve it?
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cgi-bin error (Permission Denied) Help! Amorgos Programming 8 09-08-2008 10:20 PM
Nagios & cgi-bin JJX Linux - Software 0 10-12-2005 07:24 AM
Cannot access cgi-bin directory for Nagios hywaydave23 Linux - Software 1 10-12-2005 06:16 AM
cgi-bin error regarding perl script hamish Linux - Software 11 12-09-2004 10:16 AM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 07:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration