1 minute read

With all the remote work we’ve been doing, there has been occasion to mount a remote filesystem on a local machine to make it easier to edit code. While using ssh to connect to a remote machine and then editing in vi is possible, we’d much prefer to take advantage of the richer features of an IDE such as sublime or VSCode. IDEs are at their best when they have access to a local filesystem, so we’d like to mount the remote files locally.

On a machine running Gnome, the Files (formerly called, and still launched with, nautilus) tool offers an easy way to mount remote drives using the “Other Locations” tab:

remote

This would use gvfs to mount an ssh share using my account at mycorp.com. It would appear as a local folder, which the IDE could access easily. However, what if the machine I need to access is two hops away? Suppose I must first log into a jump box to get through a firewall, and from there sign into the target machine? Is there a way to mount those files locally? Fortunately, there is:

  1. Create (or edit) a file called ~/.ssh/config on your local machine.

  2. Add two sets of lines: the first to define the jump box, and the second to interpret an ssh connection request to the target machine:

Host jumpbox
  HostName 123.45.67.89

Host target-machine
  ProxyCommand ssh -A -t me@jumpbox nc 10.18.1.5
  1. Connect to the target machine from nautilus:
remote-jump

Dialog boxes may appear with password requests, but this is an easy (and secure) way to locally mount files from a remote machine.

Updated: