...
Code Block | ||||
---|---|---|---|---|
| ||||
<?php // programmed by Chun Kang $s = ssh2_connection( '192.168.10.8', 22); if (ssh2_auth_password( $s, 'your_id', 'your_password')) { echo "Authentication successful!\n"; } else { die( "Authentication failed...\n"); } shh2_exec( $s, "shutdown -r -f 0"); ?> |
Now you can run your command by web or command line like below
Code Block |
---|
$ php reboot.php |
https://www.thelinuxfaq.com/253-how-to-install-ssh2-extension-for-php-rhel-centos-7