LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   howto start vpnclient with php script and sudo ? (https://www.linuxquestions.org/questions/programming-9/howto-start-vpnclient-with-php-script-and-sudo-133927/)

cccc 01-12-2004 05:16 AM

howto start vpnclient with php script and sudo ?
 
hi

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

<?php

$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.

my problem is:
howto start vpnclient via browser with this script using sudo ?

I'm using linux SuSE 8.2 and Apache 1.3.27

kind regards
cccc

cccc 01-12-2004 11:46 AM

I tried with :

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

and is working well.

regards
cccc


All times are GMT -5. The time now is 02:07 PM.