sshd error无法加载主机密钥
时间:2019-08-20 17:58:31 来源:igfitidea点击:
在Ubuntu18.04 LTS服务器版中发现报错:
“sshd error:could not load host key”(无法加载主机密钥)。
Sep 29 16:01:28 lab sshd[1088]: error: key_load_private: invalid format Sep 29 16:01:28 lab sshd[1088]: error: key_load_public: invalid format Sep 29 16:01:28 lab sshd[1088]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key Sep 29 16:01:28 lab sshd[1088]: error: key_load_private: invalid format Sep 29 16:01:28 lab sshd[1088]: error: key_load_public: invalid format Sep 29 16:01:28 lab sshd[1088]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key Sep 29 16:01:28 lab sshd[1088]: error: key_load_private: invalid format Sep 29 16:01:28 lab sshd[1088]: error: key_load_public: invalid format Sep 29 16:01:28 lab sshd[1088]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key Sep 29 16:01:28 lab sshd[1088]: fatal: No supported key exchange algorithms [preauth]
如何修复“sshd错误:无法加载主机密钥”
首先备份ssh config文件夹。
sudo cp -rvf /etc/sshd ~/sshd-backup
删除ssh主机密钥。
sudo rm /etc/ssh/ssh*key
重新生成ssh密钥
sudo dpkg-reconfigure openssh-server
重新启动openssh服务器
sudo systemctl restart ssh