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
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 4

Expert Comment

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

Author Comment

by:micro_learner
ID: 11718262
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
ID: 11720562
Try:
AddHandler cgi-script cgi pl
instead of:
SetHandler cgi-script
in the <Directory> block
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Author Comment

by:micro_learner
ID: 11722104
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
ID: 11724167
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
ID: 11829060
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
ID: 12146047
Split between all 3?
0

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
erroer in installing php7.0.7 on an apache 2 machine 4 157
phpPgAdmin problem 14 277
How code a 301 redirect for folder files -> 1 file 2 79
phpmyadmin memory error 55 94
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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