欢迎来到魔幻小生的博客

启动SSH服务提示Could not load host key: /etc/ssh/ssh_host_rsa_key...的解决方法

在使用服务器的过程中遇到启动了SSH服务也无法远程连接的问题,通过systemctl status sshd查看提示Could not load host key: /etc/ssh/ssh_host_rsa_key...等一系列报错信息,在此记录一下解决方案。

Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key

image

需要重新生成主机密钥文件!

ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key

image

重启SSH服务systemctl restart sshd

问题解决!

image

posted @ 2022-11-02 14:55  魔幻小生  阅读(3493)  评论(0编辑  收藏  举报