Node:Top, Next:, Previous:(dir), Up:(dir)

TRAMP User Manual

TRAMP stands for `Transparent Remote (file) Access, Multiple Protocol'. This package provides remote file editing, similar to ange-ftp and EFS.

The difference is that ange-ftp uses FTP to transfer files between the local and the remote host, whereas TRAMP uses a combination of rsh and rcp or other work-alike programs, such as ssh/scp.

This is version $Revision: 1.37 $ of the TRAMP manual, last updated on Sunday, 1 October, 2000.

You can find the latest version of this document on the web at http://ls6-www.informatik.uni-dortmund.de/~grossjoh/emacs/tramp.html.

This manual is also available as a Japanese translation.

The latest release of TRAMP is available for download, or you may see Obtaining TRAMP for more details, including the CVS server details.

There is a mailing list for TRAMP, available at emacs-rcp@ls6.cs.uni-dortmund.de, and archived at http://www.mail-archive.com/emacs-rcp@ls6.cs.uni-dortmund.de/.


Node:Copying, Next:, Previous:Top, Up:Top

TRAMP Copying conditions

Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.

tramp.el is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

tramp.el is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Node:Overview, Next:, Previous:Copying, Up:Top

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

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

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


Node:Obtaining TRAMP, Next:, Previous:Overview, Up:Top

Obtaining TRAMP.

TRAMP is freely available on the Internet and the latest release may be downloaded from ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz. This release includes the full documentation and code for TRAMP, suitable for installation.

For the especially brave, TRAMP is available from CVS. The CVS version is the latest version of the code and may contain incomplete features or new issues. Use these versions at your own risk.

To obtain the latest development version of TRAMP from CVS (see cvs(1)), you may use the following sequence of commands (text you enter is in bold):

] cd ~/lisp
] cvs -d :pserver:cvs@bonny.cs.uni-dortmund.de:/services/emacs-rcp/cvsroot login
(Logging in to cvs@bonny.cs.uni-dortmund.de)
CVS password: (just hit RET here)
...

] cvs -d :pserver:cvs@bonny.cs.uni-dortmund.de:/services/emacs-rcp/cvsroot get tramp

You should now have a directory ~/lisp/tramp containing the latest version of TRAMP. You can fetch the latest updates from the repository by issuing the command:

] cd ~/lisp/tramp
] cvs update -d


Node:History, Next:, Previous:Obtaining TRAMP, Up:Top

History of TRAMP

Development was started end of November 1998. The package was called `rssh.el', back then. It only provided one method to access a file, using ssh to log in to a remote host and using scp to transfer the file contents. After a while, the name was changed to `rcp.el', and now it's TRAMP. Along the way, many more methods for getting a remote shell and for transferring the file contents were added. Support for VC was added.

The most recent addition of a major feature was the multi-hop methods added in April 2000.


Node:Installation, Next:, Previous:History, Up:Top

Installing TRAMP into Emacs or XEmacs

Installing TRAMP into your Emacs or XEmacs is a relatively easy process, at least compared to rebuilding your machine from scratch. ;)

Seriously though, the installation should be a fairly simple matter.

The easiest way to proceed is as follows:

For XEmacs users, the package fsf-compat must be installed. For details on package installation, see Packages. (If the previous link doesn't work, try the XEmacs documentation at the XEmacs site.)


Node:Configuration, Next:, Previous:Installation, Up:Top

Configuring TRAMP for use

TRAMP is fully functional when it is initially installed. It is initially configured to use the rsh and rcp programs to connect to the remote host.

If you do not wish to use these commands to connect to the remote host, you should change the default connection and transfer method that TRAMP uses. There are several different methods that TRAMP can use to connect to remote machines and transfer files (see Connection types).


Node:Connection types, Next:, Previous:Configuration, Up:Configuration

Types of connections made to remote machines.

There are two basic types of transfer methods, each with it's own advantages and limitations. Both types of connection make use of a remote shell access program such as rsh, ssh or telnet to connect to the remote machine.

This connection is used to perform many of the operations that TRAMP requires to make the remote file system transparently accessible from the local machine. It is only when visiting files that the methods differ.

Loading or saving a remote file requires that the content of the file be transfered between the two machines. The content of the file can be transfered over the same connection used to log in to the remote machine or the file can be transfered through another connection using a remote copy program such as rcp, scp or rsync. The former are called inline methods, the latter are called external transfer methods.

The performance of the external transfer methods is generally better than that of the inline methods. This is caused by the need to encode and decode the data when transferring inline.

The one exception to this rule are the scp based transfer methods. While these methods do see better performance when actually transferring files, the overhead of the cryptographic negotiation at startup may drown out the improvement in file transfer times.

External transfer methods do require that the remote copy command is not interactive -- that is, the command does not prompt you for a password. If you cannot perform remote copies without a password, you will need to use an inline transfer method to work with TRAMP.

A variant of the inline methods are the multi-hop methods. These methods allow you to connect a remote host using a number `hops', each of which connects to a different host. This is useful if you are in a secured network where you need to go through a bastion host to connect to the outside world.


Node:Inline methods, Next:, Previous:Connection types, Up:Configuration

Inline methods

The inline methods in TRAMP are quite powerful and can work in situations where you cannot use an external transfer program to connect. Inline methods are the only methods that work when connecting to the remote machine via telnet. (There are also strange inline methods which allow you to transfer files between user identities rather than hosts, see below.)

These methods depend on the existence of a suitable encoding and decoding command on remote machine. Locally, TRAMP may be able to use features of Emacs to decode and encode the files or it may require access to external commands to perform that task.

TRAMP supports the use of uuencode to transfer files. This is not recommended. The uuencode and uudecode commands are not well standardized and may not function correctly or at all on some machines, notably AIX and IRIX. These systems do not work with uuencode at all. (But do see the note about AIX in the documentation for tramp-methods.)

In summary, if possible use the mimencode methods to transfer the data base64 encoded. This has the advantage of using a built-in command in every modern Emacs, improving performance.


Node:External transfer methods, Next:, Previous:Inline methods, Up:Configuration

External transfer methods

The external transfer methods operate through multiple channels, using the remote shell connection for many actions while delegating file transfers to an external transfer utility.

This saves the overhead of encoding and decoding that multiplexing the transfer through the one connection has with the inline methods.

If you want to use an external transfer method you must be able to execute the transfer utility to copy files to and from the remote machine without any interaction.

This means that you will need to use ssh-agent if you use the scp program for transfers. If you use rsync via ssh then the same rule must apply to that connection.

If you cannot get scp to run without asking for a password but would still like to use ssh to secure your connection, have a look at the ssh based inline methods.


Node:Multi-hop Methods, Next:, Previous:External transfer methods, Up:Configuration

Connecting to a remote host using multiple hops

Sometimes, the methods described before are not sufficient. Sometimes, it is not possible to connect to a remote host using a simple command. For example, if you are in a secured network, you might have to log in to a `bastion host' first before you can connect to the outside world. Of course, the target host may also require a bastion host. The format of multi-hop filenames is slightly different than the format of normal TRAMP methods.

A multi-hop file name specifies a method, a number of hops, and a path name on the remote system. The method specifies how the file is transferred through the inline connection. The following two multi-hop methods are available:

Each hop consists of a hop method specification, a user name and a host name. The following hop methods are (currently) available:


Node:Default Method, Next:, Previous:Multi-hop Methods, Up:Configuration

Selecting a default method

When you select an appropriate transfer method for your typical usage you should set the variable tramp-default-method to reflect that choice. This variable controls which method will be used when a method is not specified in the TRAMP file path. For example:

(setq tramp-default-method "scp")

External transfer methods are normally preferable to inline transfer methods, giving better performance. They may not be useful if you use many remote machines where you cannot log in without a password.

See Inline methods. See External transfer methods. See Multi-hop Methods.

Another consideration with the selection of transfer methods is the environment you will use them in and, especially when used over the Internet, the security implications of your preferred method.

The rsh and telnet methods send your password as plain text as you log in to the remote machine, as well as transferring the files in such a way that the content can easily be read from other machines.

If you need to connect to remote systems that are accessible from the Internet, you should give serious thought to using ssh based methods to connect. These provide a much higher level of security, making it a non-trivial exercise for someone to obtain your password or read the content of the files you are editing.


Node:Customizing Methods, Next:, Previous:Default Method, Up:Configuration

Using Non-Standard Methods

There is a variable tramp-methods which you can change if the predefined methods don't seem right.

For the time being, I'll refer you to the Lisp documentation of that variable, accessible with C-h v tramp-methods <RET>.


Node:Remote Programs, Previous:Customizing Methods, Up:Configuration

How TRAMP finds and uses programs on the remote machine.

TRAMP depends on a number of programs on the remote host in order to function, including ls, test, find and cat.

In addition to these required tools, there are various tools that may be required based on the connection method. See Inline methods and External transfer methods for details on these.

Certain other tools, such as perl (or perl5) and grep will be used if they can be found. When they are available, they are used to improve the performance and accuracy of remote file access.

When TRAMP connects to the remote machine, it searches for the programs that it can use. The variable tramp-remote-path controls the directories searched on the remote machine.

By default, this is set to a reasonable set of defaults for most machines. It is possible, however, that your local (or remote ;) system administrator has put the tools you want in some obscure local directory.

In this case, you can still use them with TRAMP. You simply need to add code to your .emacs to add the directory to the remote path. This will then be searched by TRAMP when you connect and the software found.

To add a directory to the remote search path, you could use code such as:

(require 'tramp)                ; TRAMP must be loaded before this
                                ; happens.

; We have perl in "/usr/local/perl"
(add-to-list 'tramp-remote-path "/usr/local/perl")


Node:Usage, Next:, Previous:Configuration, Up:Top

Using TRAMP

Once you have installed TRAMP it will operate fairly transparently. You will be able to access files on any remote machine that you can log in to as though they were local.

Files are specified to TRAMP using a formalized syntax specifying the details of the system to connect to. This is similar to the syntax used by the EFS and ange-ftp packages.


Node:Filename Syntax, Next:, Previous:Usage, Up:Usage

TRAMP filename conventions

To access the file <path> on the remote machine <machine> you would specify the filename /r:<machine>:<path>. This will connect to <machine> and transfer the file using the default method. See Default Method.

Some examples of TRAMP filenames are:

/r:melancholia:.emacs
Edit the file .emacs in your home directory on the machine melancholia.
/r:melancholia.danann.net:.emacs
This edits the same file, using the fully qualified domain name of the machine.
/r:melancholia:~/.emacs
This also edits the same file -- the ~ is expanded to your home directory on the remote machine, just like it is locally.
/r:melancholia:~daniel/.emacs
This edits the file .emacs in the home directory of the user daniel on the machine melancholia. The ~<user> construct is expanded to the home directory of that user on the remote machine.
/r:melancholia:/etc/squid.conf
This edits the file /etc/squid.conf on the machine melancholia.

Unless you specify a different name to use, TRAMP will use the current local user name as the remote user name to log in with. If you need to log in as a different user, you can specify the user name as part of the filename.

To log in to the remote machine as a specific user, you use the syntax /r:<user>@<machine>:/path/to.file. That means that connecting to melancholia as daniel and editing .emacs in your home directory you would specify /r:daniel@melancholia:.emacs.

It is also possible to specify other file transfer methods (see Default Method) as part of the filename. This is done by replacing the initial /r: with /r@<method>:. The user, machine and file specification remain the same.

So, to connect to the machine melancholia as daniel, using the su method to transfer files, and edit .emacs in my home directory I would specify the filename /r@su:daniel@melancholia:.emacs.


Node:Multi-hop filename syntax, Next:, Previous:Filename Syntax, Up:Usage

Multi-hop filename conventions

The syntax of multi-hop file names is necessarily slightly different than the syntax of other TRAMP file names. Here's an example multi-hop file name:

/r@multi:rsh#out@gate:telnet#kai@real.host:/path/to.file

This is quite a mouthful. So let's go through it step by step. The file name consists of three parts, separated by colons. The first part is /r@multi, the method specification. The second part is rsh#out@gate:telnet#kai@real.host and specifies the hops. (Yes, the second part may contain even more colons, so that's why this file name has more than two colons in it.) The final part is /path/to.file and specifies the file name on the remote host.

The first part and the final part should be clear. Multi-hop Methods, for a list of alternatives for the method specification.

The second part can be subdivided again into components, so-called hops. In the above file name, there are two hops, rsh#out@gate and telnet#kai@real.host.

Each hop can again be subdivided into (three) components, the hop method, the user name and the host name. The meaning of the second and third component should be clear, and the hop method says what program to use to perform that hop.

The first hop, rsh#out@gate, says to use rsh to log in as user out to the host gate. Starting at that host, the second hop, telnet#kai@real.host, says to use telnet to log in as user kai to host real.host.

See Multi-hop Methods, for a list of possible hop method values. The variable tramp-multi-connection-function-alist contains the list of possible hop methods and information on how to execute them, should you want to add your own.


Node:Dired, Previous:Multi-hop filename syntax, Up:Usage

Dired and filename completion

TRAMP works transparently with dired, enabling you to use this powerful file management tool to manage files on any machine you have access to over the Internet.

Filename completion also works with TRAMP for files on remote machines although there is no completion for user names or machine names at this stage.

As filename completion needs to fetch the listing of files from the remote machine, this feature is sometimes fairly slow. As TRAMP does not yet cache the results of directory listing, there is no gain in performance the second time you complete filenames.

If you need to browse a directory tree, Dired is a better choice, at present, than filename completion. Dired has it's own cache mechanism and will only fetch the directory listing once.


Node:Bug Reports, Next:, Previous:Usage, Up:Top

Reporting Bugs and Problems

Bugs and problems with TRAMP are actively worked on by the development team. Feature requests and suggestions are also more than welcome.

The TRAMP mailing list is a great place to get information on working with TRAMP, solving problems and general discussion and advice on topics relating to the package.

The mailing list is at emacs-rcp@ls6.cs.uni-dortmund.de. Messages sent to this address go to all the subscribers. This is not the address to send subscription requests to.

For help on subscribing to the list, send mail to the administrative address, emacs-rcp-request@ls6.cs.uni-dortmund.de, with the subject help.

To report a bug in TRAMP, you should execute M-x tramp-bug. This will automatically generate a buffer with the details of your system and TRAMP version.

When submitting a bug report, please try to describe in excruciating detail the steps required to reproduce the problem, the setup of the remote machine and any special conditions that exist.

If you can identify a minimal test case that reproduces the problem, include that with your bug report. This will make it much easier for the development team to analyze and correct the problem.


Node:Frequently Asked Questions, Next:, Previous:Bug Reports, Up:Top

Frequently Asked Questions


Node:Version Control, Next:, Previous:Frequently Asked Questions, Up:Top

The inner workings of remote version control

Unlike EFS and ange-ftp, TRAMP has full shell access to the remote machine. This makes it possible to provide version control for files accessed under TRAMP.

The actual version control binaries must be installed on the remote machine, accessible in the directories specified in tramp-remote-path.

This transparent integration with the version control systems is one of the most valuable features provided by TRAMP, but it is far from perfect. Work is ongoing to improve the transparency of the system.


Node:Version Controlled Files, Next:, Previous:Version Control, Up:Version Control

Determining if a file is under version control

The VC package uses the existence of on-disk revision control master files to determine if a given file is under revision control. These file tests happen on the remote machine through the standard TRAMP mechanisms.


Node:Remote Commands, Next:, Previous:Version Controlled Files, Up:Version Control

Executing the version control commands on the remote machine

There are no hooks provided by VC to allow intercepting of the version control command execution. The calls occur through the call-process mechanism, a function that is somewhat more efficient than the shell-command function but that does not provide hooks for remote execution of commands.

To work around this, the functions vc-do-command and vc-simple-command have been advised to intercept requests for operations on files accessed via TRAMP.

In the case of a remote file, the shell-command interface is used, with some wrapper code, to provide the same functionality on the remote machine as would be seen on the local machine.


Node:Changed workfiles, Next:, Previous:Remote Commands, Up:Version Control

Detecting if the working file has changed

As there is currently no way to get access to the mtime of a file on a remote machine in a portable way, the vc-workfile-unchanged-p function is advised to call an TRAMP specific function for remote files.

The tramp-vc-workfile-unchanged-p function uses the functioning VC diff functionality to determine if any changes have occurred between the workfile and the version control master.

This requires that a shell command be executed remotely, a process that is notably heavier-weight than the mtime comparison used for local files. Unfortunately, unless a portable solution to the issue is found, this will remain the cost of remote version control.


Node:Checking out files, Next:, Previous:Changed workfiles, Up:Version Control

Bringing the workfile out of the repository

VC will, by default, check for remote files and refuse to act on them when checking out files from the repository. To work around this problem, the function vc-checkout knows about TRAMP files and allows version control to occur.


Node:Miscellaneous Version Control, Previous:Checking out files, Up:Version Control

Things related to Version Control that don't fit elsewhere

Minor implementation details, &c.


Node:Remote File Ownership, Next:, Previous:Miscellaneous Version Control, Up:Miscellaneous Version Control

How VC determines who owns a workfile

Emacs provides the user-full-name function to return the login name of the current user as well as mapping from arbitrary user id values back to login names. The VC code uses this functionality to map from the uid of the owner of a workfile to the login name in some circumstances.

This will not, for obvious reasons, work if the remote system has a different set of logins. As such, it is necessary to delegate to the remote machine the job of determining the login name associated with a uid.

Unfortunately, with the profusion of distributed management systems such as NIS, NIS+ and NetInfo, there is no simple, reliable and portable method for performing this mapping.

Thankfully, the only place in the VC code that depends on the mapping of a uid to a login name is the vc-file-owner function. This returns the login of the owner of the file as a string.

This function has been advised to use the output of ls on the remote machine to determine the login name, delegating the problem of mapping the uid to the login to the remote system which should know more about it than I do.


Node:Back-end Versions, Previous:Remote File Ownership, Up:Miscellaneous Version Control

How VC determines what release your RCS is

VC needs to know what release your revision control binaries you are running as not all features VC supports are available with older versions of rcs(1), cvs(1) or sccs(1).

The default implementation of VC determines this value the first time it is needed and then stores the value globally to avoid the overhead of executing a process and parsing it's output each time the information is needed.

Unfortunately, life is not quite so easy when remote version control comes into the picture. Each remote machine may have a different version of the version control tools and, while this is painful, we need to ensure that unavailable features are not used remotely.

To resolve this issue, TRAMP currently takes the sledgehammer approach of making the release values of the revision control tools local to each TRAMP buffer, forcing VC to determine these values again each time a new file is visited.

This has, quite obviously, some performance implications. Thankfully, most of the common operations performed by VC do not actually require that the remote version be known. This makes the problem far less apparent.

Eventually these values will be captured by TRAMP on a system by system basis and the results cached to improve performance.


Node:Files directories and paths, Next:, Previous:Version Control, Up:Top

How file names, directories and paths are mangled and managed.


Node:Path deconstruction, Previous:Files directories and paths, Up:Files directories and paths

Breaking a path into it's components.

TRAMP filenames are somewhat different, obviously, to ordinary path names. As such, the lisp functions file-name-directory and file-name-nondirectory are overridden within the TRAMP package.

Their replacements are reasonably simplistic in their approach. They dissect the filename, call the original handler on the remote path and then rebuild the TRAMP path with the result.

This allows the platform specific hacks in the original handlers to take effect while preserving the TRAMP path information.


Node:Issues, Previous:Files directories and paths, Up:Top

Debatable Issues and What Was Decided


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