Many people have encountered the problem of ssh_exchange_identification: Connection closed by remote host when connecting to a remote machine with ssh . I found a bunch of tutorials on the Internet and tried it, but it didn’t work. The blogger summed up several common solutions (all local machine operation ).
-
Possible reason 1 : openssh-server is not installed ; solution:
sudo apt install openssh-server
or
sudo apt-get install openssh-server
-
Possible reason 2 : The connection exceeds the MaxSessions limit; solution: modify
sudo gedit /etc/ssh/sshd_config
,# MaxSessions 10
cancel the comment in and10
change to50
-
Possible reason 3 : ip is denied; solution: check separately
/var/log/denyhosts
,/etc/hosts.deny
andusr/share/denyhosts/data/hosts/
whether there is an intercepted ip record in and, if so, add your ip to it/etc/hosts.allow
.