GNU Info

Info Node: (tramp)Overview

(tramp)Overview


Next: Obtaining TRAMP Prev: Top Up: Top
Enter node , (file) or (file)node

An overview of TRAMP
********************

After the installation of TRAMP into your Emacs, you will be able to
access files on remote machines as though they were local.  Access to
the remote file system for editing files, version control, and `dired'
are transparently enabled.

   Your access to the remote machine can be with the `rsh', `rlogin',
`telnet' programs or with any similar connection method.  This
connection must pass ASCII successfully to be usable but need not be
8-bit clean.

   The package provides support for `ssh' connections out of the box,
one of the more common uses of the package.  This allows relatively
secure access to machines, especially if `ftp' access is disabled.

   The majority of activity carried out by TRAMP requires only that the
remote login is possible and is carried out at the terminal.  In order
to access remote files TRAMP needs to transfer their content to the
local machine temporarily.

   TRAMP can transfer files between the machines in a variety of ways.
The details are easy to select, depending on your needs and the
machines in question.

   The fastest transfer methods (for large files) rely on a remote file
transfer package such as `rcp', `scp' or `rsync'.  The use of these
methods is only possible if the file copy command does not ask for a
password for the remote machine.

   If the remote copy methods are not suitable for you, TRAMP also
supports the use of encoded transfers directly through the shell.  This
requires that the `mimencode' or `uuencode' tools are available on the
remote machine.  These methods are generally faster for small files.

   Within these limitations, TRAMP is quite powerful.  It is worth
noting that, as of the time of writing, it is far from a polished
end-user product.  For a while yet you should expect to run into rough
edges and problems with the code now and then.

   It is finished enough that the developers use it for day to day work
but the installation and setup can be a little difficult to master, as
can the terminology.

   TRAMP is still under active development and any problems you
encounter, trivial or major, should be reported to the TRAMP developers.
Note: Bug Reports.

Behind the scenes
.................

This section tries to explain what goes on behind the scenes when you
access a remote file through TRAMP.

   Suppose you type `C-x C-f' and enter part of an TRAMP file name,
then hit `<TAB>' for completion.  Suppose further that this is the
first time that TRAMP is invoked for the host in question.  Here's what
happens:

   * TRAMP discovers that it needs a connection to the host.  So it
     invokes `telnet HOST' or `rsh HOST -l USER' or a similar tool to
     connect to the remote host.  Communication with this process
     happens through an Emacs buffer, that is, the output from the
     remote end goes into a buffer.

   * The remote host may prompt for a login name (for `telnet').  The
     login name is given in the file name, so TRAMP sends the login
     name and a newline.

   * The remote host may prompt for a password or pass phrase (for
     `rsh' or for `telnet' after sending the login name).  TRAMP
     displays the prompt in the minibuffer, asking you for the password
     or pass phrase.

     You enter the password or pass phrase.  TRAMP sends it to the
     remote host, followed by a newline.

   * TRAMP now waits for the shell prompt or for a message that the
     login failed.

     If TRAMP sees neither of them after a certain period of time (a
     minute, say), then it issues an error message saying that it
     couldn't find the remote shell prompt and shows you what the
     remote host has sent.

     If TRAMP sees a `login failed' message, it tells you so, aborts
     the login attempt and allows you to try again.

   * Suppose that the login was successful and TRAMP sees the shell
     prompt from the remote host.  Now TRAMP invokes `/bin/sh' because
     Bourne shells and C shells have different command syntaxes.(1)

     After the Bourne shell has come up, TRAMP sends a few commands to
     ensure a good working environment.  It turns off echoing, it sets
     the shell prompt, and a few other things.

   * Now the remote shell is up and it good working order.  Remember,
     what was supposed to happen is that TRAMP tries to find out what
     files exist on the remote host so that it can do filename
     completion.

     So, TRAMP basically issues `cd' and `ls' commands and also
     sometimes `echo' with globbing.  Another command that is often
     used is `test' to find out whether a file is writable or a
     directory or the like.  The output of each command is parsed for
     the necessary operation.

   * Suppose you are finished with filename completion, have entered
     `C-x C-f', a full file name and hit `<RET>'.  Now comes the time to
     transfer the file contents from the remote host to the local host
     so that you can edit them.

     See above for an explanation of how TRAMP transfers the file
     contents.

     For inline transfers, TRAMP issues a command like `mimencode -b
     /path/to/remote/file', waits until the output has accumulated in
     the buffer that's used for communication, then decodes that output
     to produce the file contents.

     For out-of-band transfers, TRAMP issues a command like the
     following:
          rcp user@host:/path/to/remote/file /tmp/tramp.4711
     It then reads the local temporary file `/tmp/tramp.4711' into a
     buffer and deletes the temporary file.

   * You now edit the buffer contents, blithely unaware of what has
     happened behind the scenes.  (Unless you have read this section,
     that is.)  When you are finished, you type `C-x C-s' to save the
     buffer.

   * Again, TRAMP transfers the file contents to the remote host either
     inline or out-of-band.  This is the reverse of what happens when
     reading the file.


   I hope this has provided you with a basic overview of what happens
behind the scenes when you open a file with TRAMP.

   ---------- Footnotes ----------

   (1) Invoking `/bin/sh' will fail if your login shell doesn't
recognize `exec /bin/sh' as a valid command.  Maybe you use the Scheme
shell `scsh'...


automatically generated by info2www version 1.2.2.9