PDA

View Full Version : [ubuntu] how to set iptable rules and access superuser permission from web-based?



hong2010
March 30th, 2010, 11:57 AM
Hi friends..
i had wrote a network emulator program in c programming. It can run for ubuntu terminal with good performance. But i have to make it for web-based user configuration. So i had setup apache web server and write this program in cgi script and try to execute this program from web page. BUT IT CAN'T WORKS!!!

This program must be run in root privilege($sudo -s) and add the iptables rules such as (#iptables -A OUTPUT -j QUEUE). So my question is how to add iptables rules in my cgi scripts? How to set the superuser(root privilege) permission to access my program through web server? Or any other method? your reply is highly appreciate... thanks..:P

iponeverything
March 30th, 2010, 02:08 PM
Setup sudo for your apache user "www-data" with permissions for iptables and invoke it from the script with sudo.

hong2010
April 9th, 2010, 06:43 AM
Setup sudo for your apache user "www-data" with permissions for iptables and invoke it from the script with sudo.

Hi iponeverthing... i not quite understand how to setup sudo for apache, can you briefly explain the procedures? thanks...