Operating System - Linux
1822549 Members
2985 Online
109642 Solutions
New Discussion юеВ

howto start vpn client with PHP script via browser using sudo ?

 
SOLVED
Go to solution
'chris'
Super Advisor

howto start vpn client with PHP script via browser using sudo ?

hi

I wrote PHP script, to start vpnclient on my
linux server SuSE 8.2 :


$result = exec("ping -c 4 X.X.X.X");

if ("$result?"!= "0") {

exec("/etc/init.d/vpnclient_init restart");

}

?>

from shell as root user this script is working well.

but howto start vpnclient via browser with this script using sudo?

kind regards
chris
2 REPLIES 2
Michael Schulte zur Sur
Honored Contributor
Solution

Re: howto start vpn client with PHP script via browser using sudo ?

Hi,

I would assume with:
sudo -V | -h | -l | -L | -v | -k | -K | -s | [ -H ] [-P ] [-S ] [ -b ] | [ -p prompt ] [ -c class|- ] [ -a auth_type ] [ -u username|#uid ] command

exec("sudo -u root /etc/init.d/vpnclient_init restart");

greetings,

Michael

'chris'
Super Advisor

Re: howto start vpn client with PHP script via browser using sudo ?

thanks

it works.