Enable suEXEC2010/07/24 |
Normally executing user for CGI is Apache, but it's possible to execute CGI with other users by using suEXEC. |
|
[1] | Enable suEXEC |
root@www05:~# aptitude -y install apache2-suexec-custom root@www05:~# a2enmod suexec Enabling module suexec. Run '/etc/init.d/apache2 restart' to activate new configuration! |
[2] | For example, configure to enable suEXEC under a directory "lucid". |
root@www05:~# vi /etc/apache2/suexec/www-data # add at the head: write directories you'd like to enable suEXEC /home/lucid/public_html /var/www public_html/cgi-bin root@www05:~# vi /etc/apache2/sites-enabled/virtual.host <VirtualHost *:80> ServerName www.virtual.host ServerAdmin webmaster@virtual.host DocumentRoot /home/lucid/public_html ErrorLog /var/log/apache2/virtual.host.error.log CustomLog /var/log/apache2/virtual.host.access.log combined LogLevel warn # add: let lucid a executing user SuexecUserGroup lucid lucid </VirtualHost> Run '/etc/init.d/apache2 reload' to activate new configuration! root@www05:~# /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. |
lucid@www05:~$ cd public_html lucid@www05:~/public_html$ vi suexec.cgi #!/usr/local/bin/perl print "Content-type: text/html\n\n"; print <<"EOM"; <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> suEXEC Test Page </div> </body> </html> EOM exit; lucid@www05:~/public_html$ chmod 700 suexec.cgi |
Sponsored Link |