问题:
VMware虚拟机中的Centos7无法SSH登陆,重启SSH服务和虚拟机皆无效,在本地输入命令ssh 127.0.0.1也无法登陆,提示Read from socket failed: Connection reset by peer。
|
1
2
3
4
5
6
|
# ssh 127.0.0.1
Read from socket failed:Connection reset by peer
# systemctl status sshd
sshd:error:could not load host key:
/etc/ssh/ssh_host_rsa_key
sshd:error:could not load host key:
/etc/ssh/ssh_host_ecdsa_key
sshd:error:could not load host key:
/etc/ssh/ssh_host_ed25519_key
|
解决:
|
1
2
3
4
5
|
# ls -la /etc/ssh/ssh*key
# rm -rf /etc/ssh/ssh*key
# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
# ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
# ssh 127.0.0.1
|
本文转自 结束的伤感 51CTO博客,原文链接:http://blog.51cto.com/wangzhijian/1870279