我正在编写一个使用 libssh 库的应用程序。我正在尝试建立从应用程序运行的客户端到服务器的连接。但是,我没有连接,而是收到一条错误消息:
[ERR]: Starting the SSH session failed (kex error : no match for method server host key algo: server [ssh-rsa], client [ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256]).
Run Code Online (Sandbox Code Playgroud)
我想更改服务器主机密钥算法以便可以建立连接,但我不知道在哪里执行此操作。我已经重新创建了我的服务器主机密钥。我认为我可以通过 进行配置/etc/ssh/sshd_config,但我无法找到正确的标志。我在服务器上的文件如下所示:
# $OpenBSD: sshd_config,v 1.97 2015/08/06 14:53:21 deraadt Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default …Run Code Online (Sandbox Code Playgroud)