ssh問題:ssh_exchange_identification: Connection closed by remote host...
剛剛一個朋友告訴我SSH連接不上服務器了,重啟電腦也不管用.我仔細看了一下,老報如下錯誤:
ssh_exchange_identification: Connection closed by remote host
the connection to the remote host was lost . this usually means that you network connection went down or that the remote host was rebooted most network outages are short. and thus trying again may work
(1) 最簡單的解決方法就是讓 /etc/hosts.allow 和 /etc/hosts.deny里面的所有信息都不生效,全部注銷掉, 重啟SSH服務就可以了.但是,有時候在你修改后不久,仍然會出現/etc/hosts.deny自動修改,讓你還是登錄不了,此時需要檢查denyhosts服務。
在redhat系列的版本中,有一個denyhosts服務,會自動覆蓋/etc/hosts.deny文件,在確認要登錄的機器沒有問題時,可以簡單做如下處理:
/etc/init.d/denyhosts stop
vim /etc/hosts.allow文件,加入 sshd:ALL。
(2) 但是還有一種情況,就是客戶端連接數過多時,也會報這個錯誤。缺省情況下,SSH終端連接數最大為10個。在這種情況下,需要改SSH的配置文件,
解決方案:1) 修改/etc/ssh/sshd_config中#MaxStartups 10,將其改為MaxStartups 1000
2) 重啟SSH服務,/etc/init.d/ssh restart