SSH 连接失败:无法处理系统配置文件

SSH Connection failed : Failed to process system configuration files

我正在尝试在笔记本 Windows 10 上的 ssh 客户端和安装在 VMWare 上的 Ubuntu 之间建立简单的 SSH 连接。我将 libssh 用于 ssh 支持,将 Qt Creator 用作 IDE。这是一段代码:

int verbosity = SSH_LOG_PROTOCOL;
int port = 22;
ssh_session ssh = ssh_new();
if (ssh == nullptr)
{
    QMessageBox::critical(this, "Error", "Something went wrong with allocation!", QMessageBox::Ok);
}
else
{
    QMessageBox::information(this, "Succes", "Allocation was successful!", QMessageBox::Ok);
}
ssh_options_set(ssh, SSH_OPTIONS_USER, "root");
ssh_options_set(ssh, SSH_OPTIONS_HOST, "192.168.237.128");
ssh_options_set(ssh, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
ssh_options_set(ssh, SSH_OPTIONS_PORT, &port);
int rc = ssh_connect(ssh);

if (rc != SSH_OK)
{
    QMessageBox::critical(this, "Eroare", "SSH Connection failed!", QMessageBox::Ok);
    //ssh_free(ssh);
}

连接失败,我总是收到错误:"Failed to process system configuration files"。Windows 和 Linux 之间的连接适用于 Putty/PowerShell,我在 ~/. ssh 和 OpenSSH 已安装。我认为这是一个客户端问题,但我卡在了这一点上。

如果有人面临或将面临这个问题,我用来避免这个错误的解决方法是使用 SSH_OPTIONS_SSH_DIR 选项设置 ssh 目录。

const char* sshDirectory = "path/to/.ssh/";
ssh_options_set(sshSession, SSH_OPTIONS_SSH_DIR, sshDirectory);