首页 > 代码库 > ssh_exchange_identification: Connection closed by remote host

ssh_exchange_identification: Connection closed by remote host

解决方法:

------------------------------------------------------------------------

主要是 /etc/hosts.allow 和 /etc/hosts.deny问题 最好两个都设置一下。
因为有些系统是先load hosts.allow 再 load hosts.allow .有些相反。 
hosts.allow: 
ALL:ALL:allow sshd sshd1 sshd2:ALL:allow #ssh:0.0.0.0/0.0.0.0 sshd:192.168.1.:allow hosts.deny sshd[2760]: 
# you should know that NFS uses portmap!
ALL:ALL EXCEPT 127.0.0.1:DENY to ALL:ALL EXCEPT 127.0.0.1 AND 192.168.1.111:DENY

完成后。重启sshd :
service sshd restart     /etc/init.d/sshd restart

 

------------------------------------------------------------------------

# vi /etc/ssh/sshd_config 
# MaxSessions 10 
去掉前面的"#" 并把数字改大,我先改为60了,最后重启service sshd reload然后重新连接即可.  

附:

查看Linux服务器有多少个用户连接ssh的方法

命令行输入

  1. who

如果想要断开某个ssh 用户 可以在命令行输入 

  1. ps aux |grep sshd 

得到pid 再用命令关闭那个pid: 

  1. kill -111

ssh_exchange_identification: Connection closed by remote host