Let me pose this question another way.... Please indulge me.
I am the user. jrr is my login. I want to enable a cgi-bin directory in
/home/jrr/cgi-bin.
What I have done thus far is this:
1) I edited my httpd.conf to look like this:
ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
ScriptAlias /cgi-bin/ "/home/jrr/cgi-bin/"
2) I created the directory /home/jrr/cgi-bin
3) I said $chmod 755 /home/jrr/cgi-bin
4) I copied "test-cgi" from /usr/local/apache/cgi-bin to /home/jrr/cgi-bin.
5) I said $chmod 755 /home/jrr/cgi-bin/*
When I reference the URL http://localhost.localdomain/~jrr/cgi-bin/test-cgi I
get this error in the browser:
Not Found
The requested URL /~jrr/cgi-bin/test-cgi was not found on this server.
Apache/1.3.20 Server at 127.0.0.1 Port 80
However, when I reference apache's cgi-bin with
http://localhost.localdomain/cgi-bin/test-cgi, all is well with the world.
So... for some reason it's not working. One thing that did catch my eye was
in the error message that the browser gave. Why does it say "The requested
URL /~jrr/cgi-bin/test-cgi was not found on this server."?? It says it can't
find "/~jrr/cgi-bin/test-cgi". Why doesn't it say the whole path, being
"/home/jrr/cgi-bin/test-cgi", or
"http://localhost.localdomain/~jrr/cgi-bin/test-cgi"? Or something like
that....
Am I typing in the correct URL in the browser? Is the way I set my
permissions ok? Did I edit httpd.conf correctly? What am I missing?
Seems to me there is something very simple, yet very essential, that I am
missing.
Please... once again... any help is very much appreciated.
Thank you,
Jimmy
> > I've got Apache 1.3 running on Redhat 7.1. The installation went just
> > fine, and I can execute scripts from /usr/local/apache/cgi-bin.
> > My question is 2 fold:
> > 1) What changes need to be made to .conf files to add a user
> ><joeblo> so that Apache looks at /home/joeblo/cgi-bin?
> Their cgi-bin should under their UserDir (typically public_html).
> Otherwise suexec (if enabled) will not work.
> ScriptAliasMatch ^/[~](.*)/cgi-bin/(.*) /home/$1/public_html/cgi-bin/$2
> Although I personally prefer to be able to run CGI anywhere in my webspace
> so I can group relavant html, cgi and data in a dir or connected
> subdirectories.
> > and
> > 2) What permissions (chmod/chown) need to be set to /home/joeblo
> > and /home/joeblo/cgi-bin, as well as what are the permissions needed for
> > the actual scripts?
> Typically directories and CGI scripts are 755, and other files are 644.
> Following are minimum permissions:
> /home and joeblo need at least 701 permission (dir needs x bit for
> access). Their public_html would need at least 701 for access or 705
> minimum to do any Indexing (file listing).
> If all CGI runs as 'nobody' or similar, cgi-bin could be as little as 701.
> CGI scripts would need at least 705. CGI data files (to write) would need
> to already exist with 606, or to create new files, the dir would need 707.
> That is rather insecure since anybody elses CGI could access your data
> and it may be hard to tell who (as nobody) started any problems.
> If you run apache suexec (or cgi-wrap) to run CGI as you, the CGI script
> itself can have as little as 700 permission and could access data files
> with 600 permission. But the dir would need at least 701 if it contains
> .htaccess, .htpasswd, or any URL accessible non-CGI files (html, images,
> etc.), and those files would need at least 604. It is also easier to
> track anything gone astray because it will have a username associated with
> it. Note that under suexec, CGI will refuse to run if script or dir
> permission is greater than 755, since more permission would be insecure
> and is not necessary when CGI is running as you.
> > It seems like such a common question that arises, yet I've searched and
> > searched for some simple, straight-forward answers. Yet no luck. As I
> > said, I'm a newbie... so speak slowly =)
> Probably because it is an OS specific thing that apache itself has nothing
> to do with. For example there is a Win32 version of Apache, and I have no
> idea how Windows tracks permissions when not built into the filesystem.
> --
> David Efflandt (Reply-To is valid) http://www.de-srv.com/
> http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
> http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/