I want to SFTP to a remote computer that is behind NAT. I can't modify the NAT router, so I have set up a reverse SSH tunnel using a middleman server.
Here's what my SSH tunnel looks like:
laptop--->nat--->middleman<--nat<--desktop
The full details are here:
Remote desktop over SSH reverse tunnel to replace TeamViewer
I am currently using SSH and VNC over this tunnel.
How do I use SFTP over the tunnel?
I assume the command will look something like
sftp://localhost:port
SSH login is via key pair only (no password) so we need to consider that in the solution. And I use KDE, so I need to get this working with Dolphin file manager. I've heard that setting up SFTP authentication in Dolphin can be a pain…
I'll be running Dolphin on the laptop and connecting to the file system on the desktop like this.
laptop(SFTP client)--->nat--->middleman<--nat<--desktop(SFTP server)
P.S. I would consider sshfs too, if that would be easier. I assume it won't because I don't have a domain name or IP address for the server.
Best Answer
First, this is a prerequesite (at least for me): Remote desktop over SSH reverse tunnel to replace TeamViewer
The reverse SSH tunnel looks like this:
On
laptop
edit ~/.ssh/config and add this:Then, with an existing SSH leg from laptop to middleman established already (as per above link), do the following:
Finally, open Dolphin (if using KDE like me) and enter this location: