

Tramp: Sending command `exec env SHELL=/ bin/sh sudo -u root -s -H -p Password: ' Tramp: Found remote shell prompt on `another_box' Tramp: Sending command `exec ssh -e none another_box' Tramp: Found remote shell prompt on `jump_box ' Tramp: Waiting for prompts from remote shell.done Tramp: Waiting for prompts from remote shell. Tramp: Sending command `exec ssh -o ControlMasterauto -o ControlPath'tramp.%C' -o ControlPersist=no -e none jump_box' Tramp: Opening connection for using sudo. Loading /etc/emacs/site-start.d/ 50notmuch.el ( source).

Loading / var/ cache/dictionaries-common/emacsen-ispell-dicts.el ( source). Loading / var/ cache/dictionaries-common/emacsen-ispell-default.el ( source). Loading /etc/emacs/site-start.d/ 50dictionaries-common.el ( source). Loading /etc/emacs/site-start.d/ 50cmake-data.el ( source). Loading /etc/emacs/site-start.d/ 50autoconf.el ( source). Let's see if this works: ~ $ emacs -q -batch -eval '(copy-directory "~/music" "/ssh:jump_box|ssh:another_box|sudo:different_user:~/music_from_cam")' TRAMP has been bundled with Emacs since 22.1 (released June 2007) so it should be available by default in any remotely modern Emacs package. But wait, can I use TRAMP anyway? Sure, just call Emacs in batch mode and invoke copy-directory. Sure, it'd take longer than rsync, but it would be simpler to do. If I were doing this interactively, I'd just use TRAMP in Emacs. but the nested ssh invocations were making my head hurt mildly, and the whole thing seemed like an inelegant hack. Ssh jump_box "ssh another_box 'chown -R different_user. Ssh jump_box "rsync -aP ~/music_from_cam another_box:/home/different_user/" I was about to write something like this: rsync -aP ~/music jump_box:~/music_from_cam Recently, I was writing a little shellscript and needed to copy some files from my local machine to another machine (let's call it another_box) that wasn't directly accessible, but which was accessible via another host (let's call it jump_box), and which finally had to end up as belonging to a non-root user ( different_user). Adventurous souls can even use this facility to transfer whole directory trees between hosts, though of course this is all very slow and hackish, and therefore to be avoided where possible, especially if both hosts are remote, since you're essentially downloading each file and re-uploading it.
EMACS TRAMP SERIES
This sets into motion a whole series of events that might or might not involve base64-encoding the file in question and piping it to temporary files along the way. For instance, if you want to edit a file on hostb, but it is locked down and only accessible via ssh from hosta, you can open the file /ssh:hosta|ssh:hostb:/path/to/file. This is of course all in service of never forcing us Emacs users to vi on a remote server: instead, we just open our file in our local Emacs using TRAMP.Īn even more interesting feature of TRAMP is that you can daisy-chain these connections onto each other. Of all the non-editing facilities that Emacs provides (which are legion), perhaps the most useful is TRAMP, a wonderfully Rube Goldberg-ian Emacs mode that allows you edit, save, and copy files remotely over all kinds of transports some of which, including some that were never really intended to be file transports.
