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:


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


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.


1 Answer 1


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:

laptop(SFTP client)--->nat--->middleman<--nat<--desktop(SFTP server)

On laptop edit ~/.ssh/config and add this:

Host SftpToDesktop
  HostName localhost
  Port %p
  User admin
  PasswordAuthentication no
  IdentityFile ~/.ssh/my_id_rsa

Then, with an existing SSH leg from laptop to middleman established already (as per above link), do the following:

$ ssh -fNL 1234:localhost:1234 -i ~/.ssh/some_id_rsa admin@middleman.com

Finally, open Dolphin (if using KDE like me) and enter this location:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.