问题:
VMware虚拟机中的Centos7无法SSH登陆,重启SSH服务和虚拟机皆无效,在本地输入命令ssh 127.0.0.1也无法登陆,提示Read from socket failed: Connection reset by peer。
# 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
解决:
# 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