licess 发表于 2016-4-25 11:57:59

sshd error: Could not load host key 解决方法

ssh客户端上连接时可能会SSH连接被直接关闭,并提示”Connection closed by foreign host.“、“Connection closed by X.X.X.X”等类似的错误信息

通过console登陆后发现
Apr 25 11:28:06 vpser sshd: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Apr 25 11:28:10 vpser sshd: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Apr 25 11:28:13 vpser sshd: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Apr 25 11:28:16 vpser sshd: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
一般可能是主机密钥出现问题,一般重新生成一些就可以

Debian/Ubunt可以执行:
rm -r /etc/ssh/ssh*key
dpkg-reconfigure openssh-server


CentOS/Fedora/RHEL可以执行:
rm -r /etc/ssh/ssh*key
systemctl restart sshd
页: [1]
查看完整版本: sshd error: Could not load host key 解决方法