Page 1 of 1

executing linux sudo command in php web page

Posted: Wed Jul 29, 2009 1:10 am
by yasantha
I want to view disk information in a PHP page by executing fdisk -l command in PHP page. But only the super user can run this command.Is anyone know how to execute this command for non super user

Re: executing linux sudo command in php web page

Posted: Wed Jul 29, 2009 3:12 am
by VladSun
An example:

/etc/sudoers

Code: Select all

Cmnd_Alias      NETWORKING = /bin/ping, ifconfig [0-9]* eth0
 
root    ALL=(ALL) ALL
www-data ALL=NOPASSWD:NETWORKING

Code: Select all

sudo ping localhost -f -c4
sudo ifconfig 192.168.0.1 eth0