Tramp is for transparently accessing remote files from within
Emacs. Tramp enables an easy, convenient, and consistent
interface to remote files as if they are local files. Tramp's
transparency extends to editing, version control, and
Tramp can access remote hosts using any number of access methods, such as rsh, rlogin, telnet, and related programs. If these programs can successfully pass ASCII characters, Tramp can use them. Tramp does not require or mandate 8-bit clean connections.
Tramp's most common access method is through ssh, a more secure alternative to ftp and other older access methods.
Tramp on MS Windows operating systems is integrated with the PuTTY package, and uses the plink program.
Tramp mostly operates transparently in the background using the connection programs. As long as these programs enable remote login and can use the terminal, Tramp can adapt them for seamless and transparent access.
Tramp temporarily transfers a remote file's contents to the local host editing and related operations. Tramp can also transfer files between hosts using standard Emacs interfaces, a benefit of direct integration of Tramp in Emacs.
Tramp can transfer files using any number of available host programs for remote files, such as rcp, scp, rsync or (under MS Windows) pscp. Tramp provides easy ways to specify these programs and customize them to specific files, hosts, or access methods.
For faster small-size file transfers, Tramp supports encoded transfers directly through the shell using mimencode or uuencode provided such tools are available on the remote host.
Accessing a remote file through Tramp entails a series of actions, many of which are transparent to the user. Yet some actions may require user response (such as entering passwords or completing file names). One typical scenario, opening a file on a remote host, is presented here to illustrate the steps involved:
C-x C-f to initiate find-file, enter part of the Tramp file name, then hit <TAB> for completion. If this is the first time connection to that host, here's what happens:
If Tramp does not receive any messages within a timeout period (a minute, for example), then Tramp responds with an error message about not finding the remote shell prompt. If any messages from the remote host, Tramp displays them in the buffer.
For any ‘login failed’ message from the remote host, Tramp aborts the login attempt, and repeats the login steps again.
Note that for the remote shell, Tramp invokes /bin/sh. The remote host must recognize ‘exec /bin/sh’ and execute the appropriate shell. This shell must support Bourne shell syntax.
For inline transfers, Tramp sends a command, such as ‘mimencode -b /path/to/remote/file’, waits until the output has accumulated in the buffer, decodes that output to produce the file's contents.
For external transfers, Tramp sends a command as follows:
rcp user@host:/path/to/remote/file /tmp/tramp.4711
Tramp reads the local temporary file /tmp/tramp.4711 into a buffer, and then deletes the temporary file.
I hope this has provided you with a basic overview of what happens behind the scenes when you open a file with Tramp.