Search code examples
sshsftpremote-access

Access remote folder via an intermmediate machine on a graphical file manager


I want to access a remote folder on a server B that is accessible only via a server A. I have accounts on both machines.

To access a terminal on B i would first connect to A via ssh, and then hop to B. To use a port on B I would do the same, establishing a port mapping via ssh tunneling.

But what can I do to access a folder on B from a graphical file manager, like dolphin, using a protocol like fish? How can I establish the intermmediate connection?

I have tried the indirect way of creating a tunnel from localhost:port to the intermmediate machine, and from there to the target machine, and connect to fish://localhost:port on the file manager, but keep getting connection refused.


Solution

  • You can do that using standard sshfs if you configure the intermediate machine as a proxy in your client configuration (default location is ~/.ssh/config):

    Host <remote>
      ProxyCommand ssh -W %h:%p proxy
    Host proxy
      Hostname <real-proxy>
    

    where <remote> is the hostname / IP address of the remote machine (%h will be replaced by it later). <real-proxy> is the hostname / IP address of the intermediate machine.

    Then you can mount your remote filesystem locally and access it using whatever graphical file manager you like:

    sshfs <remote>:/remote/path /mnt/mountpoint