0

我正在尝试使用 Net_SSH2 类登录 ssh 服务器,但出现错误:

注意:在第1389行的/var/www/html/includes/classes/Net/SSH2.php中找不到与客户端加密算法兼容的服务器

第 1389 行的代码是:

$decrypt = $this->_array_intersect_first($encryption_algorithms, $this->encryption_algorithms_server_to_client);
        $decryptKeyLength = $this->_encryption_algorithm_to_key_size($decrypt);
        if ($decryptKeyLength === null) {
            user_error('No compatible server to client encryption algorithms found');
            return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED);
        }

我用于进程的 PHP 文件:

$ssh = new Net_SSH2('192.168.111.159');
if (!$ssh->login('root', 'xxxxxxx')) {
    exit('Login Failed');
}

echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');

PS。-> 我也登录失败,但我的登录没问题,我在网络服务器上尝试了真正的终端,它工作正常。

问题是为什么我的数据是正确的登录失败以及如何修复错误。

4

2 回答 2

0

我在 SSH2.PHP 之上添加

set_include_path('includes/classes/Net/'); 

登录工作正常,错误消失了!

于 2017-03-31T08:17:21.500 回答
0

有人可以为 php7 添加,最终在 Ubuntu 16.04 上解决。

通过在我的代码中添加两行

set_include_path('/usr/share/php/phpseclib/');
include('Net/SSH2.php');
于 2020-04-01T14:18:24.640 回答