http://qs321.pair.com?node_id=11104912


in reply to cgi questions/calling perl binary in non default location

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)