Re: reboot pc with PHP

From: Date: Thu, 28 Aug 2003 22:20:37 +0000
Subject: Re: reboot pc with PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-161086@lists.php.net to get a copy of this message
Petre, et al -- ..and then Petre Agenbag said... % % Hi List Hi! % % I've gone through the list for previous questions and the only one that % seems to be a solution is to use sudo, however, I cannot seem to get it % right. .. % % Obviously these command(s) need to be run as root, so I looked at the % /etc/sudoers and added apache , BUT, in the error log it prompts for a % password. 1) Are you sure your web server is running as apache? If not, run something like passthru("/usr/bin/id") ; (or wherever your id program is) in a php page (easier than redirecting to a file :-) and see what it tells you. % % I tried to add the option NOPASSWD: ALL to the file, but it says there's % a syntax error. Your line should look about like admind ALL = (ALL) NOPASSWD: /path/to/reboot where "admind" is the name under which your web server runs. In fact, it should probably look more like admind hostname = (root) NOPASSWD: /path/to/reboot to allow admind to run reboot as root on machine "hostname". Have you read the man page for sudoers? Yes, it's a bit thick, but it absolutely covers everything you need to know :-) % % What am I missing? Since you haven't shown us your attempt, it's tough to answer that other than to note that you're at least missing showing what you tried! % % Any other ways of doing this? PS, I don't even want to consider Webmin, % it's way too complicated, I just want a handfull of predefined commands % to be run, nothing else) sudo is *definitely* your best approach. It really is. It's easy, too, I promise. % % Thanks HTH & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#161086) next »