I have a remote device running across the country using a 4G wifi dongle for connectivity. I need to remotely access the Web interface of this Wifi Dongle to edit some settings.
I have been attempting to use SSH port forwarding to allow me to access the web dashboard over my Balena device’s Public URL. However, I am not sure exactly how to achieve the intended result.
Off the top of my head (no guarantees) you could try something like this…
In your first console: balena tunnel <short-uuid> -p22222 (tunnels local port 22222 to port 22222 on your balena device).
In your seconds console: ssh -p22222 -R 80:<your-router-IP>:80 root@localhost (set up a remote port forward on the balena device to divert all port 80 traffic to port 80 on your router).
In your third console: ssh -p22222 -L 8080:localhost:80 root@localhost (set up a local port forward to divert all traffic to localhost:8080 to balena device port 80).
Point your web browser at http://localhost:8080
Looks like you have 2222 (4 twos) in the first command and 22222 (5 twos) in the second. They should both be 22222 (five twos). All commands are run on your PC terminal like you are doing.
I’ve been trying to add the ssh keys to my account.
I’ve added the id_rsa.pub key to my balena account and added the id_rsa key to the ssh-agent on my pc, but I’m still receiving the same permission denied error.
Another thing is to run ssh with verbose option -v.i.e. ssh -vT . Check the output, if need be send the output across and we can take a look as to what is causing the issue.
I can successfully authenticate with github using the ssh -vT git@github.com command. I have imported all of my keys from github to my balena account, so they should be the same.
As for running the ssh command with verbose option, the following is the output.
I have spoken to our balena cli developers about the permissions and it seems that you need to use your balenaCloud username instead of root, e.g.
balena tunnel <short-uuid> -p22222 ssh -p22222 -R 80:<your-router-IP>:80 <cloud-username>@localhost ssh -p22222 -L 8080:localhost:80 <cloud-username>@localhost
Point your web browser at http://localhost:8080
Just exit or Ctrl-D from each of the root@<uuid> shells. Alternatively you could add -N to each ssh command so that they don’t open a shell on the device - then you would just use Ctrl-C to terminate each port forward.