Question

Ubuntu 14.04/Serverpilot running CGI Scripts

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 https://serverpilot.io/community/articles/how-to-create-a-cgi-bin-directory.html (updating the document root) but can’t get CGI or Perl scripts to run, instead being returned as plain text.

Any thoughts?

Cole


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Accepted Answer

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):

https://serverpilot.io/community/articles/how-to-run-a-simple-ftp-server.html

Ryan Quinn
DigitalOcean Employee
DigitalOcean Employee badge
November 3, 2016

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.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel