Enable suEXEC2015/06/03 |
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:~#
root@www:~# aptitude -y install apache2-suexec-custom a2enmod suexec Enabling module suexec. To activate the new configuration, you need to run: service apache2 restart |
[2] | For example, configure to enable suEXEC under the directory "debian". The site settings is the one created in Virtual Hostings section. |
root@www:~#
vi /etc/apache2/suexec/www-data # add to the head of a file: the directory for suEXEC /home/debian/public_html /var/www public_html/cgi-bin
root@www:~#
vi /etc/apache2/sites-available/virtual.host.conf
<VirtualHost *:80>
root@www:~# ServerName www.virtual.host ServerAdmin webmaster@virtual.host DocumentRoot /home/debian/public_html ErrorLog /var/log/apache2/virtual.host.error.log CustomLog /var/log/apache2/virtual.host.access.log combined LogLevel warn # add: let debian a executing user SuexecUserGroup debian debian </VirtualHost> systemctl restart apache2
|
[3] | Make sure a test page is shown normally with changing parmission to 700. |
debian@www:~$ mkdir public_html debian@www:~$ chmod 755 public_html
debian@www:~$
vi public_html/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"; chmod 700 public_html/suexec.cgi |
Sponsored Link |