1. 程式人生 > >ssh_exchange_identification: Connection closed by remote host 解決方法

ssh_exchange_identification: Connection closed by remote host 解決方法

share conn linux 註釋 etc all allow linu 執行

ssh_exchange_identification: Connection closed by remote host 解決方法

問題描述:
在linux主機上ssh 另一臺主機的內網地址報錯: ssh_exchange_identification: Connection closed by remote host , 通過xshell能登陸主機,


解決過程:
1.按照網上給出的方法,修改了/etc/ssh/sshd_config,
將 # MaxSessions 10 中的註釋取消掉,將10 改為 50,
service sshd reload,重啟sshd服務,仍然無法ssh。

2.查看linux服務器有多少個用戶ssh。
who

,只有8個用戶ssh主機。

3. /var/log/denyhosts 查看日誌
2018-03-21 14:49:23,330 - prefs : INFO WORK_DIR: [/usr/share/denyhosts/data]
2019-01-09 18:10:00,637 - denyhosts : INFO new denied hosts: [‘10.0.2.8‘] 發現日誌中有denyhost記錄。

查看 hosts.allow和hosts.deny文件中 沒有denyhost記錄,
查看 /usr/share/denyhosts/data/hosts/
10.0.2.8:9:Wed Jan 9 18:10:30 2019,有deny記錄。

最終解決方法: /etc/hosts.allow中加入 sshd:10.0.2.8


再執行ssh 無報錯。

ssh_exchange_identification: Connection closed by remote host 解決方法