Linux – Tunneling SFTP to another computer

apache-2.2linuxssh

Run OpenSuse 13.1 and I have access to a server via SFTP:

Question: Can a friend tunnel from another computer to mine so that he can use my SFTP client on my machine? Is this possible?

In other words: We have a situation where I have a SSH/SFTP access from my workstation to a server.
Now a friend—living somewhere else should use this access, which only works from my machine. Note the server is not (!!) directly accessible from his workstation.

We need to have SSH access from his computer to mine so that he can then SSH to the server in question.

How can I accomplish this? Why can we not just SSH from #1 to console on #2 then SSH from machine #2 to console 3 within the session? This is called “leapfrogging”

Best Answer

if your friend can ssh to you he you can tunnel like so:

ssh -L 8022:<sftp-server-ip>:22 <your-workstation-ip>

With this ssh session active your friend could access the server with localhost:8022 The catch is the they need to be able to ssh to your workstation which you'll need to forward a port on your router to do.