Ubuntu 13.04
Sponsored Link

Enable suEXEC2013/05/12

 
Normally executing user for CGI is Apache's user, but it's possible to execute CGI with other users by using suEXEC.
[1] Enable suEXEC
root@www:~#
aptitude -y install apache2-suexec-custom
root@www:~#
a2enmod suexec

To activate the new configuration, you need to run:
service apache2 restart
[2] For example, configure to enable suEXEC under a directory "ringtail".
root@www:~#
vi /etc/apache2/suexec/www-data
# add: let ringtail a executing user

/home/ringtail/public_html

/var/www
public_html/cgi-bin
root@www:~#
vi /etc/apache2/sites-enabled/virtual.host
<VirtualHost *:80>
ServerName www.virtual.host

ServerAdmin webmaster@virtual.host

DocumentRoot /home/ringtail/public_html

ErrorLog /var/log/apache2/virtual.host.error.log

CustomLog /var/log/apache2/virtual.host.access.log combined

LogLevel warn

# add

SuexecUserGroup ringtail ringtail

</VirtualHost>
root@www:~#
/etc/init.d/apache2 restart

* Restarting web server apache2
... waiting ...done.
[3] Make sure a test page is shown normally with changing parmission to 700.
ringtail@www:~$
cd public_html

ringtail@www:~/public_html$
vi suexec.cgi
#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "<html>\n<body>\n";
print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n";
print "suEXEC Test Page";
print "\n</div>\n";
print "</body>\n</html>\n";

ringtail@www:~/public_html$
chmod 700 suexec.cgi

Matched Content