views:

47

answers:

2

i try to config apache & php for my project to create web-based for file config management to open vpn in bsd unix, but i can't run as superuser to start or stop service

+1  A: 

you can use a script with a setuid to do the actual command.

ie some bash script like this would do it

#!/bin/sh
/etc/init.d/openvpn $1

you shoud chmod +s yourscript.sh and use a system('yourscript.sh start') in PHP.

Note: You have to be really careful with that because it could make big security holes

RageZ
thank you , ragez
vernomcrp
but i using mod_suexec (apache server) and FastCGI(php), I don't know how to config and test if its work, can u give any resource about that,:)
vernomcrp
it will work with anything on *nix. just give it a try
RageZ
A: 

Do you have sudo access on the machine? That is, can you prefix your start/stop commands with "sudo" to run them as a superuser?

If not, I think you're out of luck. But there's almost no information here to work with.

Funkatron
@Funkatron: sudo would require to type a password so that's a no go ...
RageZ
yes indeed. I think I misinterpreted his question, actually. Your response was probably what he was looking for.
Funkatron