Ubuntu 14.04/Serverpilot running CGI Scripts

Posted November 3, 2016 8.5k views

Got an odd Serverpilot query.

My client wants FTP access to a subfolder on the site - loathe to let them have full access so created a user with access to /home/FTPUSER and symlink to this from my /srv/users/serverpilot/apps/APPNAME/public/ folder so that they cannot access the system files for their main site, etc from a script.

PHP files from this folder are working fine but the client now wants to be able to run CGI/Perl scripts from this folder. I have tried following instructions at (updating the document root) but can’t get CGI or Perl scripts to run, instead being returned as plain text.

Any thoughts?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

You might need to have that custom user’s home directory somewhere under /srv/users due to that being the suexec root in ServerPilot’s Apache build. That is, maybe Apache is refusing to execute these scripts for security reasons because they’re under /home/CUSTOMUSER.

Alternatively, you could give your client access to a specific subdirectory by running a very simple FTP server. Take a look at this article (just added yesterday):

As a former Perl/CGI developer this brings back memories 😃

It’s been a while since I’ve set up apache to run Perl scripts but there are three primary things you’ll need to do:

1.) Make sure that mod_perl is installed and enabled:

apt-get update
apt-get install libapache2-mod-perl2
a2enmod perl
service apache2 restart

2.) In your configuration make sure that the directory where the scripts will be has the ExecCGI option.

3.) Make sure the scripts have execute permissions for the www-data user that apache runs under.