How can I use Emacs Tramp to double hop ssh?

f4hy picture f4hy · Apr 3, 2009 · Viewed 8.3k times · Source

My campus only lets ssh access through a gateway server. So to access the cluster I am coding on I have to ssh to the gateway and then ssh to the machine I am working on. The connection is very slow at times and is frustrating to work on.

I would love to use something like tramp which I understand would have the buffer open on my local machine and only talk through the network when I save to disk. I am not very familiar with tramp at all and struggling to get it to work, especially through the double hop. The documentation says this is accomplished through defining proxies in tramp, but I am unable to understand the syntax.

Does anyone know how to use emacs to code through a double hop or have an alternate workaround for editing code through two ssh hops?

Answer

Joseph Lisee picture Joseph Lisee · May 7, 2013

At least as of Emacs 24 they have a new version of multi you can open paths like this:

   /ssh:bird@bastion|ssh:you@remotehost:/path

I can confirm that this works on my version of Emacs 24.3.1. The docs describe it here.