123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- use PHPUnit\Framework\TestCase;
- define('APP_ID', 'test');
- define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_CORE_PATH . '/lrlz.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- function my_ssh_disconnect($reason, $message, $language) {
- printf("Server disconnected with reason code [%d] and message: %s\n",
- $reason, $message);
- }
- class TestSSH2 extends TestCase
- {
- public static function setUpBeforeClass(): void
- {
- // Base::run_util();
- }
- public function testConnect()
- {
- $connection = ssh2_connect('121.89.223.81', 22, ['hostkey'=>'ssh-rsa']);
- if (ssh2_auth_pubkey_file($connection, 'root',
- '/home/root/.ssh/id_rsa.pub',
- '/home/root/.ssh/id_rsa', '')) {
- echo "Public Key Authentication Successful\n";
- } else {
- die('Public Key Authentication Failed');
- }
- }
- }
|