Phew, tell me about it :). Made me learn something, though. Heh.

So is this a security measure or just a normal part of linux file
permissions? Is it that no cgi script, anywhere, will run if it has root
permissions or is it that it just wouldn't run because it was in a user's
home directory?

mitch





                                                                                       
                        
                    "Miark"                                                            
                        
                    <miark@acsol.        To:     <[EMAIL PROTECTED]>                 
                        
                    net>                 cc:                                           
                        
                                         Subject:     Re: [newbie] Is CGI set up ... 
FIXED                     
                    01/04/02                                                           
                        
                    03:39 PM                                                           
                        
                                                                                       
                        
                                                                                       
                        




Phew!
Congrats!

I can think of many times when apache couldn't run a
script because I (inadvertently) created it as root.
Fickle things, these servers.

Miark


----- Original Message -----
From: <        >
To: <[EMAIL PROTECTED]>
Sent: Friday, January 04, 2002 2:09 PM
Subject: Re: [newbie] Is CGI set up ... FIXED


>
> The problem was the group permissions: the cgi-bin and files were owned
by
> the root group. I changed ownership to the mitch group, and now my cgi
> scripts run from a link in a web page when called with a browser. I had
> created the cgi-bin as root orginally, because I thought that only the
> admin could do it. Now I see that's not true, since the commonhttpd.conf
> allows the owner of a public_html directory to create their own cgi-bin.
>
> Maybe there shouldn't be a "mitch" group? Anyway, I'm just glad it works.
> Thanks for the help everyone! I learned a lot about some subjects that
were
> just vauge to me before, ie, apache configuration files and commands. The
> correct permissions were already set for cgi in the commonhttpd.conf,
which
> gets included into httpd.conf; so I didn't need to change anything in
> there. I changed it all back to default settings.
>
> mitch
>
>
>
>
>                     [EMAIL PROTECTED]
>                     Sent by:                     To:
[EMAIL PROTECTED]
>                     newbie-owner@linux-ma        cc:
>                     ndrake.com                   Subject:     Re:
[newbie] Is CGI set up
for user accounts from normal
>                                                  install?
>
>                     01/04/02 12:35 PM
>                     Please respond to
>                     newbie
>
>
>
>
>
>
>
> Oops. I made a mistake. Not sure if it matters ... but below was the
actual
> output on my screen from running the scripts from the command line. Last
> email I had inadvertly added an extra line of space between the command
> line and the start of the output.
>
> [mitch@tcob cgi-bin]# perl -c test.cgi
> test.cgi syntax OK
>
> [mitch@tcob cgi-bin]# perl test.cgi
> Content-Type: text/html; charset=ISO-8859-1
>
> <html><head><title>Test</title></head>
> <body>The test was successful.</body></html>
>
> [mitch@tcob cgi-bin]# perl test.pl
> Content-Type: text/html; charset=ISO-8859-1
>
> <html><head><title>Test</title></head>
> <body>The test was successful.</body></html>
>
>
> mitch
>
>
>
>
>
>                     [EMAIL PROTECTED]
>
>                     Sent by:                     To:
> [EMAIL PROTECTED]
>                     newbie-owner@linux-ma        cc:
>
>                     ndrake.com                   Subject:     Re:
[newbie]
> Is CGI set up for user accounts from normal
>                                                  install?
>
>
>                     01/04/02 12:29 PM
>
>                     Please respond to
>
>                     newbie
>
>
>
>
>
>
>
>
> Yep. I did three tests. First I checked the syntax of test.cgi. It was
> fine. Then I ran test.cgi and test.pl from the command line. Here is what
I
> saw on my screen:
>
> [mitch@tcob cgi-bin]# perl -c test.cgi
> test.cgi syntax OK
>
> [mitch@tcob cgi-bin]# perl test.cgi
>
> Content-Type: text/html; charset=ISO-8859-1
>
> <html><head><title>Test</title></head>
> <body>The test was successful.</body></html>
>
> [mitch@tcob cgi-bin]# perl test.pl
>
> Content-Type: text/html; charset=ISO-8859-1
>
> <html><head><title>Test</title></head>
> <body>The test was successful.</body></html>
>
>
>
> mitch
>
>
>
>
>
>                     Keith Lynn
>
>                     <[EMAIL PROTECTED]        To:
> [EMAIL PROTECTED]
>                     u>                           cc:
>
>                     Sent by:                     Subject:     Re:
[newbie]
> Is CGI set up for user accounts from normal
>                     newbie-owner@linux-ma        install?
>
>                     ndrake.com
>
>
>
>                     01/04/02 11:21 AM
>
>                     Please respond to
>
>                     newbie
>
>
>
>
>
>
>
> Mitch,
>      Are you able to execute your scripts on the command line?
>
> Keith Lynn
> Systems Administrator
> School of Computer and Information Sciences
> University of South Alabama
> Mobile, AL 36608
> Phone: (334) 460-6390
> Fax: (334) 460-7274
> Alternate E-mail: [EMAIL PROTECTED]
> URL: http://www.cis.usouthal.edu/~lynn/
>
> On Fri, 4 Jan 2002 [EMAIL PROTECTED] wrote:
>
> >
> > Here is the cgi script:
> >
> > #! usr/bin/perl
> >
> > use CGI;
> >
> > $query = new CGI;
> >
> > print $query->header;
> >
> > print "<html><head><title>Test</title></head>\n";
> > print "<body>The test was successful.</body></html>";
> >
> >
> >
> >
> >
> > I also used this script before, but it didn't work either, same error:
> >
> > #! usr/bin/perl
> >
> > print"content-type: text/html\n\n";
> > print "<html><head><title>Test</title></head>\n";
> > print "<body>The test was successful.</body></html>";
> >
> >
> >
> >
> >
> >
>
> >                     [EMAIL PROTECTED]
>
> >                     Sent by:                     To:
> [EMAIL PROTECTED]
> >                     newbie-owner@linux-ma        cc:
>
> >                     ndrake.com                   Subject:     Re:
> [newbie] Is CGI set up for user accounts from normal
> >                                                  install?
>
> >
>
> >                     01/04/02 10:11 AM
>
> >                     Please respond to
>
> >                     newbie
>
> >
>
> >
>
> >
> >
> >
> >
> >
> > Thanks, everyone, for the help so far. I'm still having problems
though.
> I
> > made a public_html directory in my home directory and entered the
> > <directory> entry for it in commonhttpd.conf, where all other such
> entries
> > are located. (commonhttpd.conf is included into httpd.conf with
> "Include.")
> > Now at least the cgi file is found when I run it --  I no longer get
the
> > "file not found" error. But now I get a 500 Internal Server error. Here
> are
> > the error messages from the httpd error log from today:
> >
> > [Fri Jan  4 08:32:53 2002] [error] (2)No such file or directory: exec
of
> > /home/mitch/www/htdocs/myscript.cgi failed
> > [Fri Jan  4 08:32:53 2002] [error] [client 130.164.62.51] Premature end
> of
> > script headers: /home/mitch/www/htdocs/myscript.cgi
> > [Fri Jan  4 09:15:43 2002] [error] [client 130.164.62.79] Directory
index
> > forbidden by rule: /home/mitch/public_html/cgi-bin/
> > [Fri Jan  4 09:16:01 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.cgi
> > [Fri Jan  4 09:16:28 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.cgi
> > [Fri Jan  4 09:18:06 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.cgi
> > [Fri Jan  4 09:22:53 2002] [warn] child process 9685 still did not
exit,
> > sending a SIGTERM
> > [Fri Jan  4 09:22:54 2002] [warn] child process 9686 still did not
exit,
> > sending a SIGTERM
> > [Fri Jan  4 09:22:54 2002] [warn] child process 9688 still did not
exit,
> > sending a SIGTERM
> > [Fri Jan  4 09:22:54 2002] [warn] child process 9692 still did not
exit,
> > sending a SIGTERM
> > [Fri Jan  4 09:23:11 2002] [alert] httpd: Could not determine the
> server's
> > fully qualified domain name, using 130.164.62.79 for ServerName
> > [Fri Jan  4 09:23:11 2002] [notice]
Apache-AdvancedExtranetServer/1.3.20
> > (Mandrake Linux/3mdk) mod_ssl/2.8.4 OpenSSL/0.9.6b configured --
resuming
> > normal operations
> > [Fri Jan  4 09:23:11 2002] [notice] suEXEC mechanism enabled (wrapper:
> > /usr/sbin/suexec)
> > [Fri Jan  4 09:23:51 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.cgi
> > [Fri Jan  4 09:33:06 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.cgi
> > [Fri Jan  4 09:37:06 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.cgi
> > [Fri Jan  4 09:38:56 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.cgi
> > [Fri Jan  4 09:39:37 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.pl
> > [Fri Jan  4 09:50:53 2002] [error] [client 130.164.62.79] Premature end
> of
> > script headers: /home/mitch/public_html/cgi-bin/test.cgi
> >
> > mitch
> >
> >
> >
> >
> >                     Keith Lynn
> >
> >                     <[EMAIL PROTECTED]        To:     [EMAIL PROTECTED]
> >
> >                     uthal.edu>           cc:
> >
> >                                          Subject:     Re: [newbie] Is
CGI
> > set up for user accounts from normal
> >                     01/03/02             install?
> >
> >                     07:41 PM
> >
> >
> >
> >
> >
> >
> >
> > Mitch,
> >      One possible problem you might be having is that /cgi-bin is
mapped
> > to a certain directory with ScriptAlias.
> >      Suppose you wanted the user wilson to run cgi scripts in a
directory
> > called cgi-bin through the URL .../~wilson/cgi-bin, then you need to
have
> > the Directory Directive with the absolute path to that directory
> >
> >    <Directory /home/wilson/public_html/cgi-bin>
> >       AddHandler cgi-script cgi
> >       Options +ExecCGI
> >    </Directory>
> >
> >    Then make sure that /home/wilson/public_html/cgi-bin has world
execute
> > permission and the scripts in that directory have world execute
> > permission.
> >    If you still have problems, let me know.
> >
> > Keith Lynn
> > Systems Administrator
> > School of Computer and Information Sciences
> > University of South Alabama
> > Mobile, AL 36608
> > Phone: (334) 460-6390
> > Fax: (334) 460-7274
> > Alternate E-mail: [EMAIL PROTECTED]
> > URL: http://www.cis.usouthal.edu/~lynn/
> >
> > On Thu, 3 Jan 2002 [EMAIL PROTECTED] wrote:
> >
> > >
> > > So far it's still not working. I get a "file not found" error. Is
> > > "www/cis/cgi-bin" relative to what I set as DocumentRoot? In
> otherwords,
> > do
> > > I need to include the full path to the cgi bin or just the part after
> > > documentroot? Or does documentroot even have anything to with this? I
> set
> > > documentroot to /home/mitch/www/htdocs. If the cgi bin is in
> > > /home/mitch/www/cgi-bin, what do I do in <Directory>?
> > >
> > > Because I have a directory structure like:
> > >
> > >      /home/mitch/www/htdocs/myscript.html
> > >      /home/mitch/www/cgi-bin/myscript.cgi
> > >
> > > Here's what I have in my html file calling the cgi:
> > >
> > > <form method="post" action="../cgi-bin/myscript.cgi">
> > >
> > > I thought maybe trying to go up one directory ../ to get into the
> cgi-bin
> > > might be causing a problem, because documentroot was
> > > /home/mitch/www/htdocs. I don't know, but it just seemed to be making
> > > things not-so simple and straightforward. So I changed it to:
> > >
> > >      /home/mitch/www/htdocs/myscript.html
> > >      /home/mitch/www/htdocs/cgi-bin/myscript.cgi
> > >
> > > Then I redid the permissions and the html file to say action
> > > ="cgi-bin/myscript.cgi" and again as "/cgi-bin/myscript.cgi" but
> neither
> > > worked. I still get the "file not found" error.
> > >
> > > Would I get a "file not found" error because of an apache
configuration
> > > problem?
> > >
> > > mitch
> > >
> > >
> > >
> > >
> >
> > >                     Keith Lynn
> >
> > >                     <[EMAIL PROTECTED]        To:     [EMAIL PROTECTED]
> >
> > >                     uthal.edu>           cc:
> >
> > >                                          Subject:     Re: [newbie] Is
> CGI
> > set up for user accounts from normal
> > >                     01/03/02             install?
> >
> > >                     03:49 PM
> >
> > >
> >
> > >
> >
> > >
> > >
> > >
> > >
> > > Hi Mitch,
> > >      In order to allow cgi scripts to run, you need to give them
> > > permission in your httpd.conf file. Suppose you want to have scripts
> > > ending in .cgi in the directory /www/cis/cgi-bin to be interpreted as
> > > scripts. Then you would include the following in your httpd.conf
file.
> > >
> > > <Directory /www/cis/cgi-bin>
> > >    AddHandler cgi-script cgi
> > >    Options +ExecCGI
> > > </Directory>
> > >
> > >      Then make sure that permissions are set (at least world execute
on
> > > directories and scripts), and you should be able to run scripts. If
you
> > > need any other help, let me know.
> > >
> > > Keith Lynn
> > > Systems Administrator
> > > School of Computer and Information Sciences
> > > University of South Alabama
> > > Mobile, AL 36608
> > > Phone: (334) 460-6390
> > > Fax: (334) 460-7274
> > > Alternate E-mail: [EMAIL PROTECTED]
> > > URL: http://www.cis.usouthal.edu/~lynn/
> > >
> > > On Thu, 3 Jan 2002 [EMAIL PROTECTED] wrote:
> > >
> > > > I have a server on an intranet. Is CGI already set up? If so, where
> do
> > I
> > > > put my CGIs for new users? I tried to add a cgi-bin to a user's
home
> > > > directory, for myself, because I was worried about running CGIs as
> > root,
> > > if
> > > > that would even happen. So, I made a cgi-bin and set the
permissions,
> > but
> > > I
> > > > get a "You don't have permission" error message. The permissions
were
> > set
> > > > to 755, so everyone could read and execute but only I could write.
I
> > > > checked this over and over. Is there some reason that I can't *yet*
> run
> > > > CGIs other than file permissions? I tried FTPing the files as ascii
> and
> > I
> > > > tried just writing them on the linux machine. I've also used stock,
> > very
> > > > easy intro scripts that just return "Hello world" to the browser.
And
> > > I've
> > > > successfully used CGI on my personal machine hosted by
professionals.
> > It
> > > > appears to me -- I installed Mandrake myself -- that CGI isn't set
up
> > > > correctly for a user account. How do I do that?
> > > >
> > > > Could someone either explain or point me to some place where I can
> read
> > > how
> > > > to set up CGI for users on Mandrake Linux running Apache? Everthing
I
> > > find
> > > > is either just reference material -- which doesn't help if you're a
> > > newbie
> > > > -- or how to write CGIs.
> > > >
> > > > mitch
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> > Want to buy your Pack or Services from MandrakeSoft?
> > Go to http://www.mandrakestore.com
> >
> >
> >
> >
> >
> >
>
>
> Want to buy your Pack or Services from MandrakeSoft?
> Go to http://www.mandrakestore.com
>
>
>
>
>
> Want to buy your Pack or Services from MandrakeSoft?
> Go to http://www.mandrakestore.com
>
>
>
>
>
> Want to buy your Pack or Services from MandrakeSoft?
> Go to http://www.mandrakestore.com
>
>
>
>
>
>


--------------------------------------------------------------------------------



> Want to buy your Pack or Services from MandrakeSoft?
> Go to http://www.mandrakestore.com
>






Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to