ssh tunnel error "ssh_exchange_identification: Connection closed by remote host"

I'm trying to use an ssh tunnel from my office machine to my home machine, and get an error when I try to use it.

What I'm doing is starting one shell like so:

ssh -gL 12345:my.home.domain:22 my.home.domain

This is giving me a proper shell, no problem. What I normally do then is ssh to my home machine through this office machine, like so:

ssh -p 12345 127.0.0.1

This has always worked for me, until last week, when I set up a new system on my home machine (switching from Ubuntu to Debian). Now I get an error. I can still open up my initial ssh connection, but when I try to use that tunnel, I get (on the office machine) this error:

ssh_exchange_identification: Connection closed by remote host

Also, when that happens, the open shell that I have the tunnelling set up through gets this line spat out at it:

channel 3: open failed: connect failed: Connection timed out

At which point, I'm at a loss. If any more info is needed, I'll be happy to post it.

============= further to that ==============

After fiddling around further, I've found that I'm getting a different response from the server (my home machine that is) when I try to telnet in on the various ports. If I try:

telnet my.home.domain 22

I get this back:

Trying <my ip address>...
Connected to <my domain>.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze2

Which is what I would expect. After setting up the tunnel though, and then telnetting to that, I see this response:

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

============== and further still ==================

As per kbulgrien's suggestion, here is the output from the client machine with the -v option:

ssh -vp 24600 127.0.0.1
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 24600.
debug1: Connection established.
debug1: identity file /home/jacob/.ssh/id_rsa type -1
debug1: identity file /home/jacob/.ssh/id_rsa-cert type -1
debug1: identity file /home/jacob/.ssh/id_dsa type -1
debug1: identity file /home/jacob/.ssh/id_dsa-cert type -1
debug1: identity file /home/jacob/.ssh/id_ecdsa type -1
debug1: identity file /home/jacob/.ssh/id_ecdsa-cert type -1
ssh_exchange_identification: Connection closed by remote host


Solution 1:

Maybe if you have more then ssh 10 sessions waiting for insert the password, you have that kind of error, i remember that was recent ssh bug, if you would verify this, use the command below

for i in {1..15};do ssh -fNt [email protected] & >/dev/null ;done