報錯如下:
ssh_exchange_identification: read: Connection reset by peer
lost connection
問題原因
該問題通常是由於 Linux 系統通過 /etc/hosts.allow 或 /etc/hosts.deny,啓用了 TCP Wrapper 訪問控制所致。
處理辦法
要解決此問題,請進行如下配置檢查和修改:
通過 管理終端 進入系統。
通過 cat 等指令查看 /etc/hosts.allow 或 /etc/hosts.deny中是否包含類似如下配置:
all:all:deny
如果需要修改相關策略配置,在繼續之前建議進行文件備份。
使用 vi 等編輯器,按需修改 /etc/hosts.allow 和 /etc/hosts.deny中的相關配置,或者整個刪除或註釋(在最開頭添加 # 號)整行配置。比如:
all:all:deny
vi /etc/hosts.allow
其他全部註釋,追加:
sshd: ALL
重啓ssh就ok了
service sshd restart (centos6)
systemctl restart sshd (centos7)