Friday, April 27, 2012

Configuring Emacs: TRAMP

TRAMP is an Emacs library that allows you to remotely edit over a number of different protocols including ssh, sftp and scp.   With the later TRAMP libraries you have to list a set of names which define the servers you will be accessing.  The good news is you can use globs.

(require 'tramp)
(set-default 'tramp-default-proxies-alist (quote ((".*" "\\`root\\'" "/ssh:%h:"))))

You can edit remotely over an ssh connection by executing find-file and passing it:

/ssh:servername.com:path/to/remote/file

This can be used in conjunction with Transparent Multihop Connections in your ssh config to provide easy transparent access to machines behind ssh gateways.

§