LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-24-2004, 01:48 PM   #1
orish
LQ Newbie
 
Registered: May 2004
Posts: 2

Rep: Reputation: 0
Unhappy cgi-bin (object not found, access forbidden)


[This posting doesn't like url's, so I've replaced the url's below with "URL"]

Hi, I've been tearing my hair out on this one for ages. There was a similar posting about this, but I tried it all and just got more confused.

I'm using Apache 9 with Webmin. I'm trying to allow cgi scripts to run on virtual servers. I've created this in Apache directives file (httpd.conf):

DocumentRoot /home/sites/lho/web
ServerName lho.com
ServerAlias lho.com URL
ScriptAlias /cgi-bin/ /home/sites/web/lho/cgi-bin/

Then I tried to edit the entire httpd.conf file:

#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
ScriptAlias /cgi-bin/ "/home/sites/"

(I also tried commenting out the scriptalias directive, btw.)

I also ensured that there was the directive:

AddHandler cgi-script .cgi

and noticed there was a 'default' setting:

<Directory />
# Options FollowSymLinks
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
</Directory>

I then tried simply to display an index.html file in the cgi-bin directory and got "object not found", but if I changed the name to cgibin and typed in "URL/cgibin" then the file was displayed (!!??)

When I tried to execute "URL/cgi-bin/hello.cgi" I got "server error: premature end of script headers", but when I tried it with cgibin/hello.cgi I got "access forbidden". I also get this message if I comment out all the ScriptAlias directives.

hello.cgi:
#!/usr/bin/perl
print "content-type:text/html\n\nHello World!";
exit;

The cgi-bin (cgibin) directory has 777 permissions, the cgi file has 755 permissions.

What am I missing?

Many thanks...
 
Old 05-24-2004, 02:32 PM   #2
zeroability
Member
 
Registered: Dec 2002
Location: Kalamazoo, MI - US
Distribution: OpenMandriva
Posts: 144

Rep: Reputation: 15
"/home/sites" seems like a rather obscure location to keep it in. this would be reserved for the "sites" user and would have inherited permissions for that user and usually a "sites" group only. Using the "/var/www/cgi-bin" would make the most sense from a permissions standpoint.
 
Old 05-24-2004, 03:23 PM   #3
orish
LQ Newbie
 
Registered: May 2004
Posts: 2

Original Poster
Rep: Reputation: 0
cgi-bin

You are probably right about the directory structure. The idea was to give each website its own virtual server space with separate permissions. I wouldn't want to give users access to a global directory like /var/www/cgi-bin and not sure how to get round that. They could interfere with scripts belonging to other users/sites.

What would I have to do to give each virtual server the correct set of permissions in the conf file?
 
Old 05-24-2004, 03:57 PM   #4
zeroability
Member
 
Registered: Dec 2002
Location: Kalamazoo, MI - US
Distribution: OpenMandriva
Posts: 144

Rep: Reputation: 15
I am not sure what need you have to meet in terms of permissions. Outsiders only have read permission to system directories anyway. And file location is all in your scripting. That's all the help I can be I'm afraid.
 
  


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
Can not access cgi-bin from browser. Spreegem Linux - Software 6 11-07-2005 07:22 PM
Access forbidden when trying to run cgi script allan_y Linux - Software 4 10-07-2004 07:02 AM
403 Forbidden access to web with php and cgi scripts tonyboy Linux - Software 3 03-17-2004 07:45 AM
How do i access the files in my CGI-BIN rhuser Linux - Software 2 03-04-2003 03:33 PM
no access to cgi-bin j-ray Linux - General 0 04-01-2002 07:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:18 PM.

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