Solved

Creating a CGI directory for each User ---problem (Not working ..i just get to see the source code)

Posted on 2004-08-04
10
235 Views
Last Modified: 2010-03-04
Hello ..I am trying out somethings on my laptop (learning ...).I was able to configure the httpd server for CGI etc ...

Now I want to do the same for the "user" on my laptop.

I am unable to do so ...please help me on this

This is what I did...
******************************************************************************************************
1. Configured the server to take html files such that the user can access his html files by  "http://localhost/~bob/"

I did this  by  
a) Uncommenting the UserDir
b) Adding this
<Directory /home/*/html>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

This worked good

2.Next I tried to add CGI previlages to the user
I did the following ( I got this from the net)

<Directory /home/*/html/cgi-bin/>
    Options ExecCGI
    SetHandler cgi-script
</Directory>

*********************************************************************************************************
This does not work what I see is the source code that is in the sample cgi file.

Am I doing something wrong
0
Comment
Question by:micro_learner
10 Comments
 
LVL 4

Expert Comment

by:TomDavidson
Comment Utility
Do cgi applications work on the main location (without the /~user/)?
0
 

Author Comment

by:micro_learner
Comment Utility
The CGI works for the main location ....

http://localhost/cgi-bin/test.cgi  works


Normal HTML files work for the user

http://localhost/~user/test.html   works


CGI for the User show the source code in the browser

http://localhost/~user/cgi-bin/test.cgi  shows the source code
0
 
LVL 4

Accepted Solution

by:
TomDavidson earned 168 total points
Comment Utility
Try:
AddHandler cgi-script cgi pl
instead of:
SetHandler cgi-script
in the <Directory> block
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:micro_learner
Comment Utility
I am sorry but ..the problem has changed track..I mean I get a different error now.(even before i did the above..not sure why .)

It says :Premature end of Script headers:test.cgi
Error 500

I thought it could be a script problem but this does not work for even html files!
The html file that works for say http://localhost/~bob/test      
does not work  for http://localhost/~bob/cgi-bin/test   gives the same error 500

These are the permissions I currently have

/home drwxr-wr-w
/home/bob   drwxr-wr-w
/home/bob/html drwxrwxr-x
/home/bob/html/cgi-bin  drwxr-xr-x

all the files in the cgi-bin are rwxr-xr-x

P.S : This may not be a problem with the script as I am using the same script that works for http://localhost/cgi-bin/test
0
 
LVL 38

Assisted Solution

by:yuzh
yuzh earned 166 total points
Comment Utility
Have a look at this "Apache Tutorial: Dynamic Content with CGI"
http://webauthv3.stanford.edu/manual/howto/cgi.html
0
 
LVL 15

Assisted Solution

by:samri
samri earned 166 total points
Comment Utility
micro_learner,

in addition to the link that yuzh provided, you need to ensure that the CGI program actuall runs.  The easiest thing would be trying to copy the cgi file to the standard CGI folder, and see if it runs there.

The error "Premature end of..." typically the result of incorrectly written CGI, or the CGI program is sending out wrong header.  try with a simple CGI (and adjust the perl line to match those on your system):

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";


and try to use Options +ExecCGI, this would cause the ExecCGI to be added to the existing optiosn - rather than replacing all previous options.

-- and if there is still problem - check server error_log, perhaps you could post it here.

cheers.
0
 
LVL 4

Expert Comment

by:TomDavidson
Comment Utility
Split between all 3?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now