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 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 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.