3

I try to establish a remote ssh connection.

I tried to connect "Remote" with ssh -fN -R 10110:localhost:22 GatewayUser@GatewayHost

and "Gateway" with ssh -p10110 RemoteUser@localhost

I got the response on the Gateway Console Connection closed by ::1

running it with -v ssh -v -fN -R 10110:localhost:22 GatewayUser@GatewayHost

produces that response in the Remote-Console

debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_channel_open: ctype forwarded-tcpip rchan 2 win 2097152 max 32768
debug1: client_request_forwarded_tcpip: listen localhost port 10110, originator ::1 port 48481
debug1: connect_next: host localhost ([127.0.0.1]:22) in progress, fd=4
debug1: channel 0: new [::1]
debug1: confirm forwarded-tcpip
debug1: channel 0: connected to localhost port 22
debug1: channel 0: free: ::1, nchannels 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1

PS: a SSH connection from Remote to Gateway is working

Many thanks in advance!

__

Here the console-output when connecting from the gateway machineemanuel@UbuntuServer:~$ ssh -vvv -p10110 pi@localhost

OpenSSH_6.7p1 Ubuntu-5ubuntu1.3, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 10110.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/emanuel/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/emanuel/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/emanuel/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/emanuel/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/emanuel/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/emanuel/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/emanuel/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/emanuel/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4+deb7u2
debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [localhost]:10110
debug3: load_hostkeys: loading entries for host "[localhost]:10110" from file "/home/emanuel/.ssh/known_hosts"
debug3: load_hostkeys: loaded 0 keys
debug1: SSH2_MSG_KEXINIT sent
Connection closed by ::1
emanuel@UbuntuServer:~$ 
  • what are you trying to achieve? Is your sshd running on your machine? – Jakuje Oct 30 '15 at 19:18
  • sshd is running. I want to control my raspberry pi with ssh. I use an UMTS stick on the raspberry. Thus I think I need a reverse ssh tunnel. I can connect the raspberry with the Linux server, but reverse ssh is not working. – Emanuel Oct 30 '15 at 19:27
  • that makes sense. Can you run also the ssh -vvv -p10110 RemoteUser@localhost in debug mote from Gateway? – Jakuje Oct 30 '15 at 19:34
  • "::1" is IPv6-speak for "localhost" – waltinator Nov 2 '15 at 0:48
  • @Jakuje : I run it as you intended and put the console output into the question. It looks that we're on the right way to find the problem. What do you think can I improve or change to make it running? – Emanuel Nov 2 '15 at 16:09
1

What you do is: Crate a ssh connection from the raspi to the gateway, and forward the *:10110 from the gateway to 127.0.0.1:22 on the raspi. Then you connect to port 10110@localhost, which may in some configurations use the ip6-address (::1) which has no tunnel behind it. sshd then closes the connection. Try

ssh -4 -p10110 pi@localhost

This should get you one step further. If you have problems finding the correct key (ssh stops after a certain amount of checked keys) then disable pubkeyauth with

ssh -oPubkeyAuthentication=no -4 -p10110 pi@localhost
  • I tried both, but I got in both cases: ssh_exchange_identification: Connection closed by remote host – Emanuel Nov 2 '15 at 19:04
  • now it works. Solution was adding the -4 In my case, I made the mistake when I tried some things to delete the hostly files. Thank you very much for helping me – Emanuel Nov 2 '15 at 21:55
0

Your ssh client seems to connect to your sshd via IPv6. Does sshd listen on IPv6 addresses ? Add this line in /etc/ssh/sshd_config and restart sshd:

ListenAddress ::

Or you can force IPv4 connection with ssh -4 argument.

  • I add the line and got a failure. But this was already in the file: # Use these options to restrict which interfaces/protocols sshd will bind to #ListenAddress :: #ListenAddress 0.0.0.0 – Emanuel Nov 2 '15 at 16:19
  • @Emanuel: Which failure ? Do you see sshd binding on IPv6 addresses with netstat ? – Vinz Nov 2 '15 at 16:24
  • pi@raspberrypi ~ $ sudo service ssh start [....] Starting OpenBSD Secure Shell server: sshd/etc/ssh/sshd_config: line 89: Bad configuration option: ListenAdress /etc/ssh/sshd_config: terminating, 1 bad configuration options failed! – Emanuel Nov 2 '15 at 16:29
  • @Emanuel Check twice : you mispelled "Address". – Vinz Nov 2 '15 at 16:47
  • I corrected "Address". I tried to force the IPv4 Connection by typing: ssh -4 -p10110 pi@localhost, now I get the failure ssh_exchange_identification: Connection closed by remote host What must be written if I run the command netstat? – Emanuel Nov 2 '15 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.