1
votes

I'm running a raspberry pi in a remote location, so I setup a reverse ssh tunnel to one of my servers (CentOS 7) using autossh. All works fine, I can use this reverse ssh to login to the Raspberry from the server, but I can't get the server to forward the ssh, so I can not connect to the Raspberry via the server from the laptop, I always get Connection Refused. Firewall on the server has been shut down the GatewayPorts yes has been added to the sshd_config and sshd restarted.

Details:

  1. On the Raspberry I'm opening the reverse SSh tunnel:

autossh -fNC -g -M 0 -R 2223:localhost:22 [serveruser]@[server] -p2002

  1. From the server I can ssh into the Raspberry with no problem:

ssh [raspberryuser]@localhost -p2223

  1. I have added the next to /etc/ssh/sshd_config and restarted sshd service after:

GatewayPorts yes

  1. I can successfully ssh into the Raspberry from the server:

ssh [raspberryuser]@localhost -p2223

  1. But when I'm trying to connect from my laptop to the Raspberry through this server:
ssh [raspberryuser]@[server] -p2223
ssh: connect to host [server] port 2223: Connection refused
  1. The firewall on the server has been stopped

  2. SELinux is disabled on the server

I ran out of ideas, so I'm open to suggestions

1

1 Answers

1
votes

This isn't really an answer, but after restarting the server (CentOS 7), now I can connect to the Raspberry from my laptop via the server, don't receive "connection refused" anymore.

The only explanation what I have that the SSHD did not restart when I tried to restart it, although the 'messages' logs clearly shows that it was restarted repeatedly:

Dec 4 08:54:54 xxx systemd: Stopping OpenSSH server daemon...

Dec 4 08:54:54 xxx systemd: Starting OpenSSH server daemon...

In any way, the full reboot of the server has resolved it.