httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tarzan Jane <>
Subject [users@httpd] Running cgi binaries as root
Date Tue, 24 Jan 2012 14:00:17 GMT

I've installed Apache/2.2.9 on a Debian Embedded Linux system. On this embedded system I've
compiled C programs to *binary* cgi scripts. These scripts are copied to the /var/www/cgi-bin
directory and changed rights to 755. The scripts address IO-pins on the embedded system and
for that reason the scripts need to be executed as root and not as the Apache www-data user.

The apache2.conf file contains the lines: 
<VirtualHost *:80>
   DocumentRoot /var/www
   ScriptAlias /cgi-bin /var/www/cgi-bin/
  <Directory /var/www/cgi-bin/>
    Options ExecCGI
    AddHandler cgi-script .cgi .pl
If I run the scripts as root in the /var/www/cgi-bin directory all is fine. But when trying
to run the scripts using Apache via a web page nothing happens. This is because the scripts
are run as www-data user and the www-data user is not allowed to perform these actions. Suexec
doesn't work either because suexec expects ascii written cgi/php/pl script. 
What do I need to change to be able to execute the binary cgi scripts as root? And yes I'm
awear of possible security issues.
View raw message