The default apache user (i.e., the user that your cgi-bin scripts will run as) is 'apache' on redhat-like systems, and 'www-data' on Debian-like systems (i.e., Ubuntu). There is a setting in one of the apache config files to specify this. I have an old redhat server, and on it the file is /etc/httpd/conf/httpd.conf. On a newer Ubuntu server, the file is /etc/apache2/envvars. Depending on OS and version, it may be slightly different.

The reason your're seeing an error (and the answer to question #3) is probably because the default 'apache' user does not have permission to read/execute files inside /home/mytestuser. You could fix this by either doing this:

chgrp -R apache /home/mytestuser chmod -R 775 /home/mytestuser

OR - you could edit the apache config files and make mytestuser the default user (the user that apache runs as).

Either way, scripts inside /var/www/cgi-bin need to have read and execute permission by that user. If you have a group of people doing web development, you could create a "web_dev" group for them to belong to. Then files belonging to that group can be modified by any of the developers.

So, to answer question #1, I would do this:

chown apache:web_dev test.cgi chmod 770 test.cgi

Question #2: it will run as default user ('apache' - unless you change it in the config file)


In reply to Re: cgi questions/calling perl binary in non default location by scorpio17
in thread cgi questions/calling perl binary in non default location by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.