0

I created the following Alias in httpd.conf:

alias /aliasedfolder /some/location/on/the/server/folder
<Location /aliasedfolder>
  AddHandler cgi-script .pl
  Options +FollowSymLinks +ExecCGI
  Order allow,deny
  Allow from all
  AllowOverride None
</Location>

The problem is that i can view images within "aliasedfolder" but i am getting a "file does not exist" error when i run a perl script there, e.g. /aliasedfolder/script.pl.

The physical perl script exist in "/some/location/on/the/server/folder".

I made sure the script has 755 permission.

Below is the contents of the perl script:

#!/usr/bin/perl
use CGI qw/:standard/;
print "Content-type:text/html;\n\n";
print "Hello world";
1;

What seems to be the problem?

3
  • Forget about the logfiles (can't delete the comment).
    – ott--
    Dec 11, 2012 at 20:59
  • What is your documentroot ? And "/some/location/on/the/server/folder" is an absolute or a relative (to documentroot) path ? Dec 11, 2012 at 23:25
  • I see that this has been solved but shouldn't you be using "ScriptAlias" anyway?
    – igelkott
    Feb 26, 2013 at 12:49

2 Answers 2

1

After checking the ownership of /some/location/on/the/server/folder, I found out that the owner is the "root" username, whileas I was trying to access the folder through an account (domain name) on Apache that has a different username, e.g. domain.com/aliasedfolder/script.pl

The suexec mechanism is preventing this as a security feature. So, I changed the ownership of the /some/location/on/the/server/folder and the script.pl file inside it from "root" to my account's username and group, and it is working now.

This will prevent other domains pointing to my server from accessing this file (script.pl), as suexec prevents a single file to be shared by multiple domains (which have different usernames).

I can disable the suexec mechanism altogether, but I was advised not to do so due to security concerns.

Thanks for all who tried to help.

0

Have you tried using a

<Directory "/some/location/on/the/server/folder" >
    AddHandler cgi-script .pl
    ....
    AllowOverride None
</Directory>

Also are you running any security measures, such as suExec or SELinux, if you are there are additional ownership and extended attributes tweaks required for your scripts.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .