I want to connect from my computer to a remote computer using a middle server(u port forwarding). I run this command on remote computer:
ssh -R 9300:localhost:22 user@middleserver
and this one on my system:
ssh remoteuser@middelserver -p 9300
But I get this error on my system:
ssh_exchange_identification: Connection closed by remote host
this is the log of remote computer:
debug1: client_request_forwarded_tcpip: listen localhost port 9309, originator xxx.xxx.xx.xx port 21470
debug2: fd 7 setting O_NONBLOCK
debug1: connect_next: host localhost ([::1]:22) in progress, fd=7
debug2: fd 7 setting TCP_NODELAY
debug3: fd 7 is O_NONBLOCK
debug3: fd 7 is O_NONBLOCK
debug1: channel 1: new [xx.xx.xx.xx]
debug1: confirm forwarded-tcpip
debug3: channel 1: waiting for connection
debug1: channel 1: connection failed: Connection refused
debug2: fd 8 setting O_NONBLOCK
debug1: connect_next: host localhost ([127.0.0.1]:22) in progress, fd=8
debug2: fd 8 setting TCP_NODELAY
debug3: channel 1: waiting for connection
debug1: channel 1: connection failed: Connection refused
connect_to localhost port 22: failed.
debug2: channel 1: zombie
debug2: channel 1: garbage collecting
debug1: channel 1: free: xxx.xxx.xxx.xxx, nchannels 2
debug3: channel 1: status: The following connections are open:
#0 client-session (t4 r2 i0/0 o0/0 fd 4/5 cc -1)
What's the problem?