Emacs Tramp Multihops by

Emacs Tramp Multihops

Last update: 3 years ago Tag : emacs, tramp

So, usually I use a simple terminal session and vim to do some remote editing session, of course just to find/replace and some minor editing/debugging of a script. For a longer session, I user cyberduck and local text editor, and use some tunneling if the file(s) located behind other SSH.

For example, I have a remote location "Office XY", but to get there I have first login to "Branch GX", so I first create an SSH tunnel to "Branch GX", and using connect through proxy in cyberduck to list all the files in "Office XY" machine, and using emacs to edit.

Now, actually emacs itself has a tramp mode to edit the remote files, and to make it usable accessing multiple hops/machine, we need to setup a one-liner configuration, such as:

# .emacs
(add-to-list 'tramp-default-proxies-alist
             '("ip/address_of_office_xy" nil "/ssh:username@ip/address_of_branch_gx:"))

And, if you also enabled passwordless SSH session, you can avoid emacs asking password to edit remote files.


Share this post: