Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 03-20-2006, 09:33 PM   #1
LQ Newbie
Registered: Mar 2006
Posts: 3

Rep: Reputation: 0
Apache2 cgi-bin Forbidden Access

<p>I have just installed apache2 on a slackware 9.0 (old I know) platform running KDE. The HTML features work just fine in the /usr/local/apache2/htdocs/ directory. When I attempt to go to the cgi-bin directory which is accessed using "...localhost/cgi-bin" I get a notice that says </p><p>


<p>you do not have permission to access cgi-bin on this server. </p>

<p>I have full root permissions as I am setting up and for all I can tell everything is fully ready to run. Obviously there is a configuration problem with Apache or with Slackware telling me that I cannot access this file. Can somebody please help clue me in how to modify the httpd.conf file to allow this or how to alter the permissions (I do know about chmod etc) to allow this. I think it is a server setting. Thanks in advance </p>

<p>I am using essentially the original httpd.conf file I am aware that it needs modification but I have been through the tutorials about 50 times and something is not getting through to me. </p>

Last edited by cluckshot; 03-20-2006 at 09:34 PM.
Old 03-20-2006, 11:05 PM   #2
Registered: Dec 2005
Posts: 77

Rep: Reputation: 15
Smile cgi-bin

This is a very confusing post. What are you trying to do?
If you are trying to use a web browser to browse to
localhost/cgi-bin then you will get a forbidden error, this is
elementary web security. If you are logged on to the machine
that contains the cgi-bin directory (as root) then you should
have no problems. Please explain exactly what you are trying to
do and why?
Old 03-21-2006, 09:40 AM   #3
LQ Newbie
Registered: Mar 2006
Posts: 3

Original Poster
Rep: Reputation: 0

It may be elementary but I am getting the problem. I have placed both cgi and pl files in the directory to browse to and attempted to open them. It will give me the file to open in a word processor but not as a cgi-bin execution which is what I want. The problem is obviously that either the permissions are wrong or apache has a setting in httpd.conf that I have not set up to make this execute. I keep reading the docs at the apache site and have several times tried to follow their instructions which I am sure if you know what you are doing are most elementary, but they simply don't work for me .

I am to be very clear trying to get the cgi-bin operations going for perl though I might like to set up PHP etc as well. What I want is to open a file in the cgi-bin directory and have it execute. Something is stopping me and it is probably something pretty simple. If you have cgi-bin set up on your system clip the segments that do this with enough to let me know where to place them from your httpd.conf file and I will take it and run. Obviously you can obscure your roots if you want by <apache2> or some symbol. Or just tell me what the settings are.

The whole problem I am having is that if I see something work even a little bit I understand but I am finding the apache help docs just plain cryptic.

Thanks in advance for helping a starter.

Old 03-27-2006, 10:46 PM   #4
LQ Newbie
Registered: Mar 2006
Posts: 2

Rep: Reputation: 0
I am experiencing a similar problem. I have created a Redhat 4 Entreprise Linux VM using vmware. Apache runs fine, I can see the default page. Any pages I publish work fine too. If I try to use cgi I get a Forbidden page. The cgi website that I am using works fine on other Linux distributions. I have sim linked a directory in the cgi-bin directy but was missing the FollowSimLinks options in the cgi-bin section of the httpd config file. If I solve this problem I'll post a soltion asap. Ive checked the following:
Apache starts up fine
The default apache webpage displays
Any web pages I publish are fine
My cgi binary has read and execute permissions for user group and other
I can run the cgi executable manuallly - it works
As the apache user I can run the cgi executable
I've set the cgi-bin options to All in the httpd config file

Am I missing anything else?
Old 03-28-2006, 08:01 AM   #5
LQ Newbie
Registered: Mar 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Your are right

I couldn't add much more to this problem set than you have described. I think the answer is elementary but honestly it is confusing me a lot. Thanks for your post.
Old 01-09-2009, 01:26 PM   #6
Registered: Jan 2008
Location: Toronto, Canada
Distribution: Slackware, CentOS
Posts: 47

Rep: Reputation: 18

I'm pretty sure this is a long-dead post, but here's the solution in case anybody else is thick like me and takes a few minutes to figure it out...

Well, I hope everyone's ok and I'm sure you'll all be embarassed after you hear how rudimentary this is...

The fix for me was to simply use the ScriptAlias directive


ScriptAlias /cgi-bin "/web/site/foo-bar/cgi-bin"

here's the apache documentation on it:
The ScriptAlias directive has the same behavior as the Alias directive, except that in addition it marks the target directory as containing CGI scripts that will be processed by mod_cgi's cgi-script handler. URLs with a (%-decoded) path beginning with URL-path will be mapped to scripts beginning with the second argument which is a full pathname in the local filesystem.
and I just emulated the apache default config for the cgi-bin directory that I found in their config file...

<Directory "/web/site/foo-bar/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ACCESS FORBIDDEN ! Apache2. Suse 10 WindowsDependant Linux - Networking 12 11-23-2010 06:45 AM
Apache2 virtual host cgi 403 Forbidden / mossy Linux - Software 15 07-27-2005 05:56 PM
Access forbidden when trying to run cgi script allan_y Linux - Software 4 10-07-2004 08:02 AM
cgi-bin (object not found, access forbidden) orish Linux - Newbie 3 05-24-2004 04:57 PM
403 Forbidden access to web with php and cgi scripts tonyboy Linux - Software 3 03-17-2004 08:45 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:48 AM.

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