SSH 连接失败,不支持密钥交换算法

SSH 连接失败,不支持密钥交换算法

sshd有许多问题具有相同的标题,但是没有一个解决方案适用于我的问题。我的日志中出现以下错误行:

Jan  6 21:57:55 <computer name> sshd[30103]: Received signal 15; terminating.
Jan  6 21:57:55 <computer name> sshd[30175]: Server listening on 127.0.0.1 port 22.
Jan  6 21:58:00 <computer name> sshd[30184]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Jan  6 21:58:00 <computer name> sshd[30184]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Jan  6 21:58:00 <computer name> sshd[30184]: Disabling protocol version 1. Could not load host key
Jan  6 21:58:00 <computer name> sshd[30184]: fatal: No supported key exchange algorithms [preauth]

但关键文件/etc/ssh/...存在且具有正确的权限:运行la /etc/ssh/

total 276K
-rw-r--r-- 1 root root 222K Jan  6 22:01 moduli
-rw-r--r-- 1 root root 2.2K Jan  6 20:45 ssh_config
-rw-r--r-- 1 root root 2.8K Jan  6 21:57 sshd_config
-rw------- 1 root root  464 Jan  6 21:23 ssh_host_ed25519_key
-rw-r--r-- 1 root root  109 Jan  6 21:23 ssh_host_ed25519_key.pub
-rw------- 1 root root 3.3K Jan  6 21:24 ssh_host_rsa_key
-rw-r--r-- 1 root root  753 Jan  6 21:24 ssh_host_rsa_key.pub
-rw-r--r-- 1 root root  338 Jan  6 17:44 ssh_import_id

我最近改变我的配置使其更安全。我尝试重新生成所有密钥文件,但没有成功。客户端是同一台机器(尝试连接到ssh localhost),但没有成功。

答案1

好的,我想我找到了问题所在。我删除了服务器并重新安装。如果我让生成的密钥文件保留下来rsaed25519它就可以正常工作。如果我使用以下命令删除并重新生成它们,它休息

ssh-keygen -t ed25519 -f ssh_host_ed25519_key < /dev/null
ssh-keygen -t rsa -b 4096 -f ssh_host_rsa_key < /dev/null

编辑终于找到了真正的问题。如果我在密钥文件上输入密码,那么它将不起作用,并且我会收到连接已关闭的错误。

相关内容