SSH Tunneling using a remote server

Hello Forum :slight_smile:

I am trying to access my (Rasp4) using a ssh tunnel. To do that i was following this tutorial:
How To Run A Server At Home Without An IPv4 Address – WirelessMoves

I do rent a webserver, that i can access via its domain name.

Steps in short:

  • Generated Public Key on my Raspberry Pi → copied that over to my webserver, entered it into authorized_keys for my root user.

  • Changed the Config of SSH on my remote server to Gatewayports yes to allow tunneling

  • I ran

ssh -p $SSLPORT -N -R $REMOTEPORT:localhost:8123 root@$DOMAIN

netstat -tulpn on my remote server shows that my server is listening to $SSLPORT using sshd: root.

Opening $DOMAIN:$REMOTEPORT does not let me access my HomeAssistant frontend :frowning:
I’m getting the error message “connect_to localhost port 8123: failed.”

Running netstat -tulpn doesnt show the port 8123 as listening. I only have the RPI4 SSL Port, 38443 and 46483 without a program connected and 8099 for ttyd.

Now if i run:

ssh -p $SSLPORT -N -R $REMOTEPORT:localhost:8099 root@$DOMAIN

on my PI and try to access $DOMAIN:REMOTEPORT I am able to access the shell of my Pi over the Internet.

My only guess right now is, that the system has the frontend running seperately from the system so when im tunneling i would have to tunnel out of the frontend container(?) to my webserver.

If anyone has an idea what i could try that would be greatly appreciated.

I’m just guessing that this is the same problem when running shell commands via ssh, basically you can’t use the default ssh folder. It needs to go in the config folder of your HA install.


I just had the same problem. Probably you already solved it. But maybe for other people:

instead of using RH:_localhost_:LH you need to simply use RH:homeassistant.local:LH

and then it works perfectly

1 Like

Thanks! That worked for me!