問題:bash
VMware虛擬機中的Centos7沒法SSH登錄,重啓SSH服務和虛擬機皆無效,在本地輸入命令ssh 127.0.0.1也沒法登錄,提示Read from socket failed: Connection reset by peer。ssh
# 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
解決:socket
# 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