//Allow shutdown and reboot command without password but sudo
//Add this like in to /etc/sudoers file
%www-data ALL=NOPASSWD: /sbin/reboot, /sbin/shutdown
in php file /var/www/html/syscommand.php
And dont forgot to change owner of this file to www-data
$ sudo chown www-data:www-data /var/www/html/syscomnd.php
-----------------------------------------
OPEN PHP TAG
if(isset($_GET['command'])){
$command= $_GET['command'];
if( $command=='reboot'){
echo 'Reboot';
$command = 'sudo /sbin/reboot';
}
else if($command=='shutdown'){
echo 'Shutdown';
$command = 'sudo /sbin/shutdown -P now';
}
$resp = shell_exec( $command);
var_dump($resp);
}
else{
echo ' invalid request';
}
CLOSE PHP TAG
if Reboot
-----------------
URL: http://remote_ip/syscommand.php?command=reboot
if Shutdown
---------------------
URL: http://remote_ip/syscommand.php?command=shutdown
if any other command
------------------------------------
URL: http://remote_ip/syscommand.php?command=anyComamnds
Watch video Remote System reboot & Shutdown using php + URL Call from remote system in Same newtwork online without registration, duration hours minute second in high quality. This video was added by user Coders Gateway - Web Tech solutions 17 February 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 57 once and liked it 0 people.