General > Developers
PHP to execute sudo command
Govo:
Hi Folks
Working on a little project for dansguardian and squid3, mostly dansguardian, but have ran into a problem, is there away for PHP to execute sudo command.
I need to execute /etc/init.d/dansguardian restart using PHP, I have seen the command in some php files in lmce-admin, but I just can't get it to work. do I need to include some files belonging to LMCE?
Once I get pass this part my project will rolling, here is a quick video of what I have achieved so far
https://www.dropbox.com/sh/b4kwchpa153e6sr/AADbS964eH9DpuBLFCEKSON6a?dl=0
I have made some changes since this video..etc added in a delete button to remove blocked sites.
Any help would be great,
Govo
Marie.O:
sudo isn't allowed from php for everything.
Look at /etc/sudoers to understand what is possible, and what is not. In general, it makes sense to put a bash script into a well known place and use that for whatever is needed.
Govo:
Ah spot on, done some research last night and got it to work, just need to figure out why the page returns an error of no response back from server.
other than that, the project goes. on.
I can now update blocked sites, added exceptional Ip address and allow exceptional file types such as .mp3 .zip.
Thanks for the advice Posde much appreciated
Gov.
Marie.O:
yvw - thanks for working on LinuxMCE
phenigma:
fyi all, we're in the AgoControl section here. But just wanted to add that in LinuxMCE apache will permit script execution from the /usr/pluto/bin directory. Put your scripts there and they will be executable from php under apache.
J.
Navigation
[0] Message Index
[#] Next page
Go to full version