| use php to run iptables command With iptables, things are a bit more complicated than the command whoami due to the fact that only root can execute iptables command. But we can get around this with sudoers. You need to add the web server user (for example, apache) to /etc/sudoers like this
apache ALL=NOPASSWD:/sbin/iptables
then in your php script you put your command something like
$cmd="sudo /sbin/iptables Blah Blah Blah";
exec($cmd);
if you don't see /etc/sudoers, you need to get it installed first. |