How do I reverse ssh tunnel into a raspberry pi using Linode?
I need to access my raspberry pi from anywhere in the world. To do this, I have setup a Linode as the middle man SSH server on the cloud
By creating a reverse SSH tunnel from the local machine(Raspberry pi at home) to the middleman server(Linode),I created a tunnel for the middle man server to connect back to the local machine. Essentially, I am mapping a socket(combination of an IP address and a port number) on the remote machine to a socket on the local machine. Through this connection, I'm able to SSH from the remote machine to the local machine even though the local machine may be behind a NAT device.
To reverse ssh into the pi, I use the following command in the terminal window of the pi: ssh -R 7070:localhost:22 root@<ip linode="" of=""></ip>
The issue I'm having is that I cannot access the folders in the pi. Instead, I get the output "root@localhost" and when I search for folders with the "ls" command, I do not see any of the folders from the pi. I need to access one of the folders because I need to run a python program that creates a website with arrows and live video stream to control a small rc car. To access this website, I search the Pi's IP address and port number on a web browser. Any ideas on how to access the rc car's web controller using reverse ssh and Linode? (I'm still learning how to use Linux and raspberry pi)
Thanks
1 Reply
Hey there -
Without being able to see the exact output you're getting, it's tough to see exactly what might be going on. That said, I'm going to do a couple of things here - first, give you some resources that I found that might be able to help you out and second, add some tags to this post to give it some extra visibility.
Since you've mentioned that you're a novice to both Linux and the Pi, I wanted to provide you with some resources that gave basic information on SSH tunneling in general, and also doing it in conjunction with your Raspberry Pi.
The first is a guide on setting up the tunnel from Raspberry Pi's forums:
SSH tunnel to Pi via my own server
That will give you some ideas of syntax you can use to set up the tunnel properly - making sure you have the ports correct in the command.
The next is a great article on Stack Exchange which gives a detailed synopsis on how reverse SSH tunneling actually works:
How does reverse SSH tunneling work?
I hope that gives you some good direction. I'm also, as promised above, tagging this post with related, searchable terms so that other members of the Linode Community who have done this can find this post and add their thoughts.