不少人在ssh连接远程机器时遇到过ssh_exchange_identification: Connection closed by remote host的问题,在网上找了一堆教程试了都不行,博主总结了常见的几种解决方法(以Ubuntu18.04为例)。

可能原因1:没装openssh-server;解决方案:

sudo apt install openssh-server

或者

sudo apt-get install openssh-server

可能原因2:连接超过了MaxSessions限制;解决方案:修改了sudo gedit /etc/ssh/sshd_config,将 # MaxSessions 10 中的注释取消掉,将10 改为50

可能原因3:ip被deny了;解决方案:分别查看/var/log/denyhosts,/etc/hosts.deny和usr/share/denyhosts/data/hosts/中是否有拦截ip记录,有的话将你的ip添加到/etc/hosts.allow中。
 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐