1 \input texinfo @c -*-texinfo-*-
3 @setfilename ../info/tramp
4 @settitle TRAMP User Manual
8 @c This is *so* much nicer :)
11 @c In the Tramp CVS, the version number is auto-frobbed from the
12 @c Makefile, so you should edit the top-level Makefile to change
13 @c the version number.
18 @c Entries for @command{install-info} to use
21 * TRAMP: (tramp). Transparent Remote Access, Multiple Protocol
22 Emacs remote file access via rsh and rcp.
25 @c Macro to make formatting of the tramp program name consistent.
30 @c Distinguish between GNU Emacs and XEmacs. Derived from the
31 @c Makefile variable $(EMACS-ID). Valid values are `emacs' and `xemacs'.
34 @c Some flags which make the text independent on the (X)Emacs flavor.
39 @set ftp-package-name Ange-FTP
41 @set tramp-prefix-single-hop
43 @set tramp-postfix-single-hop :
44 @set tramp-postfix-multi-hop :
47 @c XEmacs counterparts.
49 @set emacs-name XEmacs
51 @set ftp-package-name EFS
53 @set tramp-prefix-single-hop [
55 @set tramp-postfix-single-hop /
56 @set tramp-postfix-multi-hop :
59 @c Macros for formatting a filename.
60 @c trampfn is for a full filename, trampfnmhp means method, host, path
61 @c were given, and so on.
62 @macro trampfn(method, user, host, path)
63 @value{tramp-prefix}@value{method}@value{user}@@@value{host}@value{tramp-postfix}@value{path}
67 Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software
71 Permission is granted to copy, distribute and/or modify this document
72 under the terms of the GNU Free Documentation License, Version 1.1 or
73 any later version published by the Free Software Foundation; with no
74 Invariant Sections, with the Front-Cover texts being ``A GNU
75 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
76 license is included in the section entitled ``GNU Free Documentation
77 License'' in the Emacs manual.
79 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
80 this GNU Manual, like GNU software. Copies published by the Free
81 Software Foundation raise funds for GNU development.''
83 This document is part of a collection distributed under the GNU Free
84 Documentation License. If you want to distribute this document
85 separately from the collection, you can do so by adding a copy of the
86 license to the document, as described in section 6 of the license.
93 @title @tramp{} version @trampver{} User Manual
95 @author by Daniel Pittman
96 @author based on documentation by Kai Gro@ss{}johann
107 @node Top, Overview, (dir), (dir)
108 @top @tramp{} version @trampver{} User Manual
110 This file documents @tramp{} version @trampver{}, a remote file
111 editing package for @value{emacs-name}.
113 @tramp{} stands for `Transparent Remote (file) Access, Multiple
114 Protocol'. This package provides remote file editing, similar to
115 @value{ftp-package-name}.
117 The difference is that @value{ftp-package-name} uses FTP to transfer
118 files between the local and the remote host, whereas @tramp{} uses a
119 combination of @command{rsh} and @command{rcp} or other work-alike
120 programs, such as @command{ssh}/@command{scp}.
122 You can find the latest version of this document on the web at
123 @uref{http://www.freesoftware.fsf.org/tramp/}.
126 This manual is also available as a @uref{tramp_ja.html, Japanese
129 The latest release of @tramp{} is available for
130 @uref{http://savannah.gnu.org/download/tramp/,
131 download}, or you may see @ref{Obtaining @tramp{}} for more details,
132 including the CVS server details.
134 @tramp{} also has a @uref{https://savannah.gnu.org/projects/tramp/,
135 Savannah Project Page}.
138 There is a mailing list for @tramp{}, available at
139 @email{tramp-devel@@mail.freesoftware.fsf.org}, and archived at
140 @uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/} as
141 well as the usual Savannah archives.
148 * Overview:: What @tramp{} can and cannot do.
151 * Obtaining @tramp{}:: How to obtain @tramp{}.
152 * History:: History of @tramp{}.
153 * Installation:: Installing @tramp{} with your @value{emacs-name}.
154 * Configuration:: Configuring @tramp{} for use.
155 * Usage:: An overview of the operation of @tramp{}.
156 * Bug Reports:: Reporting Bugs and Problems.
157 * Frequently Asked Questions:: Questions and answers from the mailing list.
160 * Version Control:: The inner workings of remote version control.
161 * Files directories and paths:: How file names, directories and paths are mangled and managed.
162 * Issues:: Debatable Issues and What Was Decided.
165 --- The Detailed Node Listing ---
167 Configuring @tramp{} for use
169 * Connection types:: Types of connections made to remote machines.
170 * Inline methods:: Inline methods.
171 * External transfer methods:: External transfer methods.
172 * Multi-hop Methods:: Connecting to a remote host using multiple hops.
173 * Default Method:: Selecting a default method.
174 * Customizing Methods:: Using Non-Standard Methods.
175 * Customizing Completion:: Selecting config files for user/host name completion.
176 * Remote Programs:: How @tramp{} finds and uses programs on the remote machine.
177 * Remote shell setup:: Remote shell setup hints.
178 * Windows setup hints:: Issues with Cygwin ssh.
182 * Filename Syntax:: @tramp{} filename conventions.
183 * Multi-hop filename syntax:: Multi-hop filename conventions.
184 * Filename completion:: Filename completion.
187 The inner workings of remote version control
189 * Version Controlled Files:: Determining if a file is under version control.
190 * Remote Commands:: Executing the version control commands on the remote machine.
191 * Changed workfiles:: Detecting if the working file has changed.
192 * Checking out files:: Bringing the workfile out of the repository.
193 * Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
195 Things related to Version Control that don't fit elsewhere
197 * Remote File Ownership:: How VC determines who owns a workfile.
198 * Back-end Versions:: How VC determines what release your RCS is.
200 How file names, directories and paths are mangled and managed.
202 * Path deconstruction:: Breaking a path into its components.
208 @chapter An overview of @tramp
211 After the installation of @tramp{} into your @value{emacs-name}, you
212 will be able to access files on remote machines as though they were
213 local. Access to the remote file system for editing files, version
214 control, and @command{dired} are transparently enabled.
216 Your access to the remote machine can be with the @command{rsh},
217 @command{rlogin}, @command{telnet} programs or with any similar
218 connection method. This connection must pass ASCII successfully to be
219 usable but need not be 8-bit clean.
221 The package provides support for @command{ssh} connections out of the
222 box, one of the more common uses of the package. This allows
223 relatively secure access to machines, especially if @command{ftp}
226 The majority of activity carried out by @tramp{} requires only that
227 the remote login is possible and is carried out at the terminal. In
228 order to access remote files @tramp{} needs to transfer their content
229 to the local machine temporarily.
231 @tramp{} can transfer files between the machines in a variety of ways.
232 The details are easy to select, depending on your needs and the
233 machines in question.
235 The fastest transfer methods (for large files) rely on a remote file
236 transfer package such as @command{rcp}, @command{scp} or
237 @command{rsync}. The use of these methods is only possible if the
238 file copy command does not ask for a password for the remote machine.
240 If the remote copy methods are not suitable for you, @tramp{} also
241 supports the use of encoded transfers directly through the shell.
242 This requires that the @command{mimencode} or @command{uuencode} tools
243 are available on the remote machine. These methods are generally
244 faster for small files.
246 Within these limitations, @tramp{} is quite powerful. It is worth
247 noting that, as of the time of writing, it is far from a polished
248 end-user product. For a while yet you should expect to run into rough
249 edges and problems with the code now and then.
251 It is finished enough that the developers use it for day to day work but
252 the installation and setup can be a little difficult to master, as can
255 @tramp{} is still under active development and any problems you encounter,
256 trivial or major, should be reported to the @tramp{} developers.
260 @subsubheading Behind the scenes
261 @cindex behind the scenes
262 @cindex details of operation
265 This section tries to explain what goes on behind the scenes when you
266 access a remote file through @tramp{}.
268 Suppose you type @kbd{C-x C-f} and enter part of an @tramp{} file name,
269 then hit @kbd{@key{TAB}} for completion. Suppose further that this is
270 the first time that @tramp{} is invoked for the host in question. Here's
275 @tramp{} discovers that it needs a connection to the host. So it
276 invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
277 @var{user}} or a similar tool to connect to the remote host.
278 Communication with this process happens through an
279 @value{emacs-name} buffer, that is, the output from the remote end
283 The remote host may prompt for a login name (for @command{telnet}). The
284 login name is given in the file name, so @tramp{} sends the login name and
288 The remote host may prompt for a password or pass phrase (for
289 @command{rsh} or for @command{telnet} after sending the login name).
290 @tramp{} displays the prompt in the minibuffer, asking you for the
291 password or pass phrase.
293 You enter the password or pass phrase. @tramp{} sends it to the remote
294 host, followed by a newline.
297 @tramp{} now waits for the shell prompt or for a message that the login
300 If @tramp{} sees neither of them after a certain period of time (a minute,
301 say), then it issues an error message saying that it couldn't find the
302 remote shell prompt and shows you what the remote host has sent.
304 If @tramp{} sees a @samp{login failed} message, it tells you so,
305 aborts the login attempt and allows you to try again.
308 Suppose that the login was successful and @tramp{} sees the shell prompt
309 from the remote host. Now @tramp{} invokes @command{/bin/sh} because
310 Bourne shells and C shells have different command
311 syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
312 shell doesn't recognize @samp{exec /bin/sh} as a valid command.
313 Maybe you use the Scheme shell @command{scsh}@dots{}}
315 After the Bourne shell has come up, @tramp{} sends a few commands to
316 ensure a good working environment. It turns off echoing, it sets the
317 shell prompt, and a few other things.
320 Now the remote shell is up and it good working order. Remember, what
321 was supposed to happen is that @tramp{} tries to find out what files exist
322 on the remote host so that it can do filename completion.
324 So, @tramp{} basically issues @command{cd} and @command{ls} commands and
325 also sometimes @command{echo} with globbing. Another command that is
326 often used is @command{test} to find out whether a file is writable or a
327 directory or the like. The output of each command is parsed for the
331 Suppose you are finished with filename completion, have entered @kbd{C-x
332 C-f}, a full file name and hit @kbd{@key{RET}}. Now comes the time to
333 transfer the file contents from the remote host to the local host so
334 that you can edit them.
336 See above for an explanation of how @tramp{} transfers the file contents.
338 For inline transfers, @tramp{} issues a command like @samp{mimencode -b
339 /path/to/remote/file}, waits until the output has accumulated in the
340 buffer that's used for communication, then decodes that output to
341 produce the file contents.
343 For out-of-band transfers, @tramp{} issues a command like the following:
345 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
347 It then reads the local temporary file @file{/tmp/tramp.4711} into a
348 buffer and deletes the temporary file.
351 You now edit the buffer contents, blithely unaware of what has happened
352 behind the scenes. (Unless you have read this section, that is.) When
353 you are finished, you type @kbd{C-x C-s} to save the buffer.
356 Again, @tramp{} transfers the file contents to the remote host either
357 inline or out-of-band. This is the reverse of what happens when reading
362 I hope this has provided you with a basic overview of what happens
363 behind the scenes when you open a file with @tramp{}.
367 @node Obtaining @tramp{}
368 @chapter Obtaining @tramp{}.
369 @cindex obtaining Tramp
371 @tramp{} is freely available on the Internet and the latest release may be
373 @uref{ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz}. This
374 release includes the full documentation and code for @tramp{}, suitable
375 for installation. But Emacs (21.4 or later) includes @tramp{}
376 already, and there is a @tramp{} package for XEmacs, as well. So
377 maybe it is easier to just use those. But if you want the bleeding
378 edge, read on@dots{...}
380 For the especially brave, @tramp{} is available from CVS. The CVS version
381 is the latest version of the code and may contain incomplete features or
382 new issues. Use these versions at your own risk.
384 Instructions for obtaining the latest development version of @tramp{}
385 from CVS can be found by going to the Savannah project page at the
386 following URL and then clicking on the CVS link in the navigation bar at
390 @uref{http://savannah.gnu.org/projects/tramp/}
393 Or follow the example session below:
396 ] @strong{cd ~/@value{emacs-dir}}
397 ] @strong{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp login}
399 (Logging in to anoncvs@@subversions.gnu.org)
400 CVS password: @strong{(just hit RET here)}
403 ] @strong{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp co tramp}
407 You should now have a directory @file{~/@value{emacs-dir}/tramp} containing the latest
408 version of @tramp{}. You can fetch the latest updates from the repository
409 by issuing the command:
412 ] @strong{cd ~/@value{emacs-dir}/tramp}
413 ] @strong{cvs update -d}
418 @chapter History of @tramp{}
420 @cindex development history
422 Development was started end of November 1998. The package was called
423 @file{rssh.el}, back then. It only provided one method to access a
424 file, using @command{ssh} to log in to a remote host and using
425 @command{scp} to transfer the file contents. After a while, the name
426 was changed to @file{rcp.el}, and now it's @tramp{}. Along the way,
427 many more methods for getting a remote shell and for transferring the
428 file contents were added. Support for VC was added.
430 The most recent addition of major features were the multi-hop methods
431 added in April 2000 and the unification of @tramp{} and Ange-FTP
432 filenames in July 2002.
436 @chapter Installing @tramp{} into @value{emacs-name}.
439 If you use the version that comes with your @value{emacs-name}, the
440 following information is not necessary. Installing @tramp{} into your
441 @value{emacs-name} is a relatively easy process, at least compared
442 to rebuilding your machine from scratch. ;)
444 Seriously though, the installation should be a fairly simple matter.
446 The easiest way to proceed is as follows:
450 Choose a directory, say @file{~/@value{emacs-dir}/}. Change into that directory and
451 unpack the tarball. This will give you a directory
452 @file{~/@value{emacs-dir}/tramp/} which contains subdirectories @file{lisp} for the
453 Lisp code and @file{texi} for the documentation.
456 Optionally byte-compile all files in the Lisp directory,
457 @file{~/@value{emacs-dir}/tramp/lisp/}, by issuing a command like the following from
458 the top level directory @file{~/@value{emacs-dir}/tramp/}:
461 make EMACS=@value{emacs-dir} all
465 NOTE: If you run into problems running the example @command{make}
466 command, don't dispare. You can still byte compile the @file{*.el}
467 files by opening @value{emacs-name} in @command{dired} (@command{C-x
468 d}) mode, at @file{~/@value{emacs-dir}/tramp/lisp}. Mark the lisp files with
469 @kbd{m}, then press @kbd{B} to byte compile your selections.
471 Something similar can be done to create the info manual. Just change
472 to directory @file{~/@value{emacs-dir}/tramp/texi} and load the
473 @file{tramp.texi} file in @value{emacs-name}. Then press @kbd{M-x
474 makeinfo-buffer @key{RET}} to generate @file{tramp.info}.
477 Tell @value{emacs-name} about the new Lisp directory and the
478 @tramp{} package with the following lines in @file{~/.emacs}:
481 (add-to-list 'load-path "~/@value{emacs-dir}/tramp/lisp/")
486 To be able to read the Info documentation, create a file
487 @file{~/@value{emacs-dir}/tramp/texi/dir} using the
488 @command{install-info} command, and add the directory to the search
492 On systems using the @cite{gnu} version of @command{install-info}, the
493 @command{install-info} syntax is very direct and simple. One can
494 change to directory @file{~/@value{emacs-dir}/tramp/texi} and type:
497 install-info tramp.info dir
500 and a @file{dir} file will be created with the @tramp{}
501 entry. The info reader will know how to interpret it, but must
502 be told where to find it (see below). If you want anything fancier
503 you'll need to look through @kbd{man install-info}.
505 Debian gnu/linux doesn't default to @cite{gnu} @command{install-info}
506 and uses its own version. This version does not create a @file{dir}
507 file for you from scratch. You must provide a skeleton @file{dir}
508 file it recognizes. One can be found in a default installation of
509 @value{emacs-name} at @file{/usr/info/dir}. Copy the top of this file
510 down to the first occurrence of @code{* Menu} including that line plus
511 one more blank line, to your working directory
512 @file{~/@value{emacs-dir}/tramp/texi}, or use the sample
513 @file{~/@value{emacs-dir}/tramp/texi/dir_sample}.
515 Once a @file{dir} file is in place, this command will make the entry:
518 install-info --infodir=. tramp.info
521 If you want it in a specific category see @kbd{man install-info} for
524 If the environment variable @env{INFOPATH} is set, add the directory
525 @file{~/@value{emacs-dir}/tramp/texi/} to it. Else, add the directory to
527 @code{Info-default-directory-list}, as follows:
530 (add-to-list 'Info-default-directory-list "~/@value{emacs-dir}/tramp/texi/")
534 @code{Info-directory-list}, as follows:
536 (add-to-list 'Info-directory-list "~/@value{emacs-dir}/tramp/texi/")
543 For @value{emacs-name}, the package @file{fsf-compat} must be installed.
544 For details on package installation, see @ref{Packages, , ,xemacs}.
546 (If the previous link doesn't work, try the @value{emacs-name}
548 @uref{http://www.xemacs.org/Documentation/packageGuide.html,the
549 @value{emacs-name} site}.)
554 @chapter Configuring @tramp{} for use
555 @cindex configuration
557 @cindex default configuration
558 @tramp{} is (normally) fully functional when it is initially
559 installed. It is initially configured to use the @command{ssh} program
560 to connect to the remote host and to use base-64 encoding (on the
561 remote host, via @command{mimencode}, and on the local host via the
562 built-in support for base-64 encoding in Emacs).
564 On some hosts, there are problems with opening a connection. These are
565 related to the behavior of the remote shell. See @xref{Remote shell
566 setup}, for details on this.
568 If you do not wish to use these commands to connect to the remote
569 host, you should change the default connection and transfer method
570 that @tramp uses. There are several different methods that @tramp{}
571 can use to connect to remote machines and transfer files
572 (@pxref{Connection types}).
576 * Connection types:: Types of connections made to remote machines.
577 * Inline methods:: Inline methods.
578 * External transfer methods:: External transfer methods.
579 * Multi-hop Methods:: Connecting to a remote host using multiple hops.
580 * Default Method:: Selecting a default method.
581 * Customizing Methods:: Using Non-Standard Methods.
582 * Customizing Completion:: Selecting config files for user/host name completion.
583 * Remote Programs:: How @tramp{} finds and uses programs on the remote machine.
584 * Remote shell setup:: Remote shell setup hints.
585 * Windows setup hints:: Issues with Cygwin ssh.
589 @node Connection types
590 @section Types of connections made to remote machines.
591 @cindex connection types, overview
593 There are two basic types of transfer methods, each with its own
594 advantages and limitations. Both types of connection make use of a
595 remote shell access program such as @command{rsh}, @command{ssh} or
596 @command{telnet} to connect to the remote machine.
598 This connection is used to perform many of the operations that @tramp
599 requires to make the remote file system transparently accessible from
600 the local machine. It is only when visiting files that the methods
603 @cindex inline methods
604 @cindex external transfer methods
605 @cindex external methods
606 @cindex out-of-band methods
607 @cindex methods, inline
608 @cindex methods, external transfer
609 @cindex methods, out-of-band
610 Loading or saving a remote file requires that the content of the file
611 be transfered between the two machines. The content of the file can be
612 transfered over the same connection used to log in to the remote
613 machine or the file can be transfered through another connection using
614 a remote copy program such as @command{rcp}, @command{scp} or
615 @command{rsync}. The former are called @dfn{inline methods}, the
616 latter are called @dfn{out-of-band methods} or @dfn{external transfer
617 methods} (@dfn{external methods} for short).
619 The performance of the external transfer methods is generally better
620 than that of the inline methods, at least for large files. This is
621 caused by the need to encode and decode the data when transferring
624 The one exception to this rule are the @command{scp} based transfer
625 methods. While these methods do see better performance when actually
626 transferring files, the overhead of the cryptographic negotiation at
627 startup may drown out the improvement in file transfer times.
629 External transfer methods do require that the remote copy command is not
630 interactive --- that is, the command does not prompt you for a password.
631 If you cannot perform remote copies without a password, you will need to
632 use an inline transfer method to work with @tramp{}.
634 @cindex multi-hop methods
635 @cindex methods, multi-hop
636 A variant of the inline methods are the @dfn{multi-hop methods}.
637 These methods allow you to connect a remote host using a number `hops',
638 each of which connects to a different host. This is useful if you are
639 in a secured network where you need to go through a bastion host to
640 connect to the outside world.
644 @section Inline methods
645 @cindex inline methods
646 @cindex methods, inline
648 The inline methods in @tramp{} are quite powerful and can work in
649 situations where you cannot use an external transfer program to connect.
650 Inline methods are the only methods that work when connecting to the
651 remote machine via telnet. (There are also strange inline methods which
652 allow you to transfer files between @emph{user identities} rather than
655 These methods depend on the existence of a suitable encoding and
656 decoding command on remote machine. Locally, @tramp{} may be able to use
657 features of Emacs to decode and encode the files or it may require
658 access to external commands to perform that task.
662 @cindex base-64 encoding
663 @tramp{} checks the availability and usability of commands like
664 @command{mimencode} (part of the @command{metamail} package) or
665 @command{uuencode} on the remote host. The first reliable command
666 will be used. The search path can be customized, see @ref{Remote
669 If both commands are'nt available on the remote host, @tramp{}
670 transfers a small piece of Perl code to the remote host, and tries to
671 apply it for encoding and decoding.
679 Connect to the remote host with @command{rsh}. Due to the unsecure
680 connection it is recommended for very local host topology only.
687 Connect to the remote host with @command{ssh}. This is identical to
688 the previous option except that the @command{ssh} package is used,
689 making the connection more secure.
691 There are also two variants, @option{ssh1} and @option{ssh2}, that
692 call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
693 explicitly select whether you want to use the SSH protocol version 1
694 or 2 to connect to the remote host. (You can also specify in
695 @file{~/.ssh/config}, the SSH configuration file, which protocol
696 should be used, and use the regular @option{ssh} method.)
698 Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
699 @command{ssh1} and @command{ssh2} commands explicitly. If you don't
700 know what these are, you do not need these options.
702 All the methods based on @command{ssh} have an additional kludgy
703 feature: you can specify a host name which looks like @file{host#42}
704 (the real host name, then a hash sign, then a port number). This
705 means to connect to the given host but to also pass @code{-p 42} as
706 arguments to the @command{ssh} command.
709 @item @option{telnet}
710 @cindex method telnet
711 @cindex telnet method
713 Connect to the remote host with @command{telnet}. This is as unsecure
714 as the @option{rsh} method.
721 This method does not connect to a remote host at all, rather it uses
722 the @command{su} program to allow you to edit files as another user.
729 This is similar to the @option{su} method, but it uses @command{sudo}
730 rather than @command{su} to become a different user.
732 Note that @command{sudo} must be configured to allow you to start a
733 shell as the user. It would be nice if it was sufficient if
734 @command{ls} and @command{mimencode} were allowed, but that is not
735 easy to implement, so I haven't got around to it, yet.
741 @cindex Cygwin (with sshx method)
743 As you expect, this is similar to @option{ssh}, only a little
744 different. Whereas @option{ssh} opens a normal interactive shell on
745 the remote host, this option uses @samp{ssh -t -t @var{host} -l
746 @var{user} /bin/sh} to open a connection. This is useful for users
747 where the normal login shell is set up to ask them a number of
748 questions when logging in. This procedure avoids these questions, and
749 just gives @tramp{} a more-or-less `standard' login shell to work
752 Note that this procedure does not eliminate questions asked by
753 @command{ssh} itself. For example, @command{ssh} might ask ``Are you
754 sure you want to continue connecting?'' if the host key of the remote
755 host is not known. Tramp does not know how to deal with such a
756 question (yet), therefore you will need to make sure that you can log
757 in without such questions.
759 This is also useful for Windows users where @command{ssh}, when
760 invoked from an Emacs buffer, tells them that it is not allocating a
761 pseudo tty. When this happens, the login shell is wont to not print
762 any shell prompt, which confuses @tramp{} mightily. For reasons
763 unknown, some Windows ports for @command{ssh} (maybe the Cygwin one)
764 require the doubled @samp{-t} option.
766 This supports the @samp{-p} kludge.
769 @item @option{krlogin}
770 @cindex method krlogin
772 @cindex Kerberos (with krlogin method)
774 This method is also similar to @option{ssh}. It only uses the
775 @command{krlogin -x} command to log in to the remote host.
782 This method is mostly interesting for Windows users using the PuTTY
783 implementation of SSH. It uses @samp{plink -ssh} to log in to the
786 CCC: Do we have to connect to the remote host once from the command
787 line to accept the SSH key? Maybe this can be made automatic?
789 CCC: Does @command{plink} support the @samp{-p} option? Tramp
790 will support that, anyway.
796 @node External transfer methods
797 @section External transfer methods
798 @cindex methods, external transfer
799 @cindex methods, out-of-band
800 @cindex external transfer methods
801 @cindex out-of-band methods
803 The external transfer methods operate through multiple channels, using
804 the remote shell connection for many actions while delegating file
805 transfers to an external transfer utility.
807 This saves the overhead of encoding and decoding that multiplexing the
808 transfer through the one connection has with the inline methods.
810 If you want to use an external transfer method you @emph{must} be able
811 to execute the transfer utility to copy files to and from the remote
812 machine without any interaction.
815 This means that you will need to use @command{ssh-agent} if you use the
816 @command{scp} program for transfers, or maybe your version of
817 @command{scp} accepts a password on the command line.@footnote{PuTTY's
818 @command{pscp} allows you to specify the password on the command line.}
819 If you use @command{rsync} via @command{ssh} then the same rule must
820 apply to that connection.
822 If you cannot get @command{scp} to run without asking for a password but
823 would still like to use @command{ssh} to secure your connection, have a
824 look at the @command{ssh} based inline methods.
828 @item @option{rcp} --- @command{rsh} and @command{rcp}
831 @cindex rcp (with rcp method)
832 @cindex rsh (with rcp method)
834 This method uses the @command{rsh} and @command{rcp} commands to connect
835 to the remote machine and transfer files. This is probably the fastest
836 connection method available.
839 @item @option{scp} --- @command{ssh} and @command{scp}
842 @cindex scp (with scp method)
843 @cindex ssh (with scp method)
845 Using @command{ssh} to connect to the remote host and @command{scp} to
846 transfer files between the machines is the best method for securely
847 connecting to a remote machine and accessing files.
849 The performance of this option is also quite good. It may be slower than
850 the inline methods when you often open and close small files however.
851 The cost of the cryptographic handshake at the start of an @command{scp}
852 session can begin to absorb the advantage that the lack of encoding and
855 There are also two variants, @option{scp1} and @option{scp2}, that
856 call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
857 explicitly select whether you want to use the SSH protocol version 1
858 or 2 to connect to the remote host. (You can also specify in
859 @file{~/.ssh/config}, the SSH configuration file, which protocol
860 should be used, and use the regular @option{ssh} method.)
862 Two other variants, @option{scp1_old} and @option{scp2_old}, use the
863 @command{ssh1} and @command{ssh2} commands explicitly. If you don't
864 know what these are, you do not need these options.
866 All the @command{ssh} based methods support the kludgy @samp{-p}
867 feature where you can specify a port number to connect to in the host
868 name. For example, the host name @file{host#42} tells Tramp to
869 specify @samp{-p 42} in the argument list for @command{ssh}.
872 @item @option{rsync} --- @command{ssh} and @command{rsync}
875 @cindex rsync (with rsync method)
876 @cindex ssh (with rsync method)
878 Using the @command{ssh} command to connect securely to the remote
879 machine and the @command{rsync} command to transfer files is almost
880 identical to the @option{scp} method.
882 While @command{rsync} performs much better than @command{scp} when
883 transferring files that exist on both hosts, this advantage is lost if
884 the file exists only on one side of the connection.
886 The @command{rsync} based method may be considerably faster than the
887 @command{rcp} based methods when writing to the remote system. Reading
888 files to the local machine is no faster than with a direct copy.
890 This method supports the @samp{-p} hack.
893 @item @option{scpx} --- @command{ssh} and @command{scp}
896 @cindex scp (with scpx method)
897 @cindex ssh (with scpx method)
898 @cindex Cygwin (with scpx method)
900 As you expect, this is similar to @option{scp}, only a little
901 different. Whereas @option{scp} opens a normal interactive shell on
902 the remote host, this option uses @samp{ssh -t -t @var{host} -l
903 @var{user} /bin/sh} to open a connection. This is useful for users
904 where the normal login shell is set up to ask them a number of
905 questions when logging in. This procedure avoids these questions, and
906 just gives @tramp{} a more-or-less `standard' login shell to work
909 This is also useful for Windows users where @command{ssh}, when
910 invoked from an Emacs buffer, tells them that it is not allocating a
911 pseudo tty. When this happens, the login shell is wont to not print
912 any shell prompt, which confuses @tramp{} mightily. Maybe this
913 applies to the Cygwin port of SSH.
915 This method supports the @samp{-p} hack.
918 @item @option{pscp} --- @command{plink} and @command{pscp}
921 @cindex pscp (with pscp method)
922 @cindex plink (with pscp method)
923 @cindex PuTTY (with pscp method)
925 This method is similar to @option{scp}, but it uses the
926 @command{plink} command to connect to the remote host, and it uses
927 @command{pscp} for transferring the files. These programs are part
928 of PuTTY, an SSH implementation for Windows.
930 CCC: Does @command{plink} support the @samp{-p} hack?
933 @item @option{fcp} --- @command{fsh} and @command{fcp}
936 @cindex fsh (with fcp method)
937 @cindex fcp (with fcp method)
939 This method is similar to @option{scp}, but it uses the @command{fsh}
940 command to connect to the remote host, and it uses @command{fcp} for
941 transferring the files. @command{fsh/fcp} are a front-end for
942 @command{ssh} which allow for reusing the same @command{ssh} session
943 for submitting several commands. This avoids the startup overhead of
944 @command{scp} (which has to establish a secure connection whenever it
945 is called). Note, however, that you can also use one of the inline
946 methods to achieve a similar effect.
948 This method uses the command @samp{fsh @var{host} -l @var{user}
949 /bin/sh -i} to establish the connection, it does not work to just say
950 @command{fsh @var{host} -l @var{user}}.
954 There is no inline method using @command{fsh} as the multiplexing
955 provided by the program is not very useful in our context. @tramp{}
956 opens just one connection to the remote host and then keeps it open,
965 This is not a natural @tramp{} method. Instead of, it forwards all
966 requests to @value{ftp-package-name}.
971 @node Multi-hop Methods
972 @section Connecting to a remote host using multiple hops
973 @cindex multi-hop methods
974 @cindex methods, multi-hop
976 Sometimes, the methods described before are not sufficient. Sometimes,
977 it is not possible to connect to a remote host using a simple command.
978 For example, if you are in a secured network, you might have to log in
979 to a `bastion host' first before you can connect to the outside world.
980 Of course, the target host may also require a bastion host. The format
981 of multi-hop filenames is slightly different than the format of normal
986 A multi-hop file name specifies a method, a number of hops, and a path
987 name on the remote system. The method name is always
990 Each hop consists of a @dfn{hop method} specification, a user name and
991 a host name. The hop method can be an inline method only. The
992 following hop methods are (currently) available:
996 @cindex hop method telnet
997 @cindex telnet hop method
999 Uses the well-known @command{telnet} program to connect to the host.
1000 Whereas user name and host name are supplied in the file name, the
1001 user is queried for the password.
1004 @cindex hop method rsh
1005 @cindex rsh hop method
1007 This uses @command{rsh} to connect to the host. You do not need to
1008 enter a password unless @command{rsh} explicitly asks for it.
1011 @cindex hop method ssh
1012 @cindex ssh hop method
1014 This uses @command{ssh} to connect to the host. You might have to enter
1015 a password or a pass phrase.
1018 @cindex hop method su
1019 @cindex su hop method
1021 This method does not actually contact a different host, but it allows
1022 you to become a different user on the host you're currently on. This
1023 might be useful if you want to edit files as root, but the remote host
1024 does not allow remote root logins. In this case you can use
1025 @option{telnet}, @option{rsh} or @option{ssh} to connect to the
1026 remote host as a non-root user, then use an @option{su} hop to become
1027 root. But @option{su} need not be the last hop in a sequence, you could
1028 also use it somewhere in the middle, if the need arises.
1030 Even though you @emph{must} specify both user and host with an
1031 @option{su} hop, the host name is ignored and only the user name is
1035 @cindex hop method sudo
1036 @cindex sudo hop method
1038 This is similar to the @option{su} hop, except that it uses
1039 @command{sudo} rather than @command{su} to become a different user.
1043 Some people might wish to use port forwarding with @command{ssh} or
1044 maybe they have to use a nonstandard port. This can be accomplished
1045 by putting a stanza in @file{~/.ssh/config} for the account which
1046 specifies a different port number for a certain host name. But it can
1047 also be accomplished within @tramp{}, by adding a multi-hop method.
1052 'tramp-multi-connection-function-alist
1053 '("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n"))
1056 Now you can use an @code{sshf} hop which connects to port 4400 instead of
1060 @node Default Method
1061 @section Selecting a default method
1062 @cindex default method
1064 @vindex tramp-default-method
1065 When you select an appropriate transfer method for your typical usage
1066 you should set the variable @var{tramp-default-method} to reflect that
1067 choice. This variable controls which method will be used when a method
1068 is not specified in the @tramp{} file path. For example:
1071 (setq tramp-default-method "scp")
1074 @vindex tramp-default-method-alist
1075 You can also specify different methods for certain user/host
1076 combinations, via the variable @var{tramp-default-method-alist}. For
1077 example, the following two lines specify to use the @option{ssh}
1078 method for all user names matching @samp{john} and the @option{rsync}
1079 method for all host names matching @samp{lily}. The third line
1080 specifies to use the @option{su} method for the user @samp{root} on
1081 the machine @samp{localhost}.
1084 (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
1085 (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1086 (add-to-list 'tramp-default-method-alist
1087 '("\\`localhost\\'" "\\`root\\'" "su"))
1091 See the documentation for the variable
1092 @var{tramp-default-method-alist} for more details.
1094 External transfer methods are normally preferable to inline transfer
1095 methods, giving better performance. They may not be useful if you use
1096 many remote machines where you cannot log in without a password.
1098 @xref{Inline methods}.
1099 @xref{External transfer methods}.
1100 @xref{Multi-hop Methods}.
1102 Another consideration with the selection of transfer methods is the
1103 environment you will use them in and, especially when used over the
1104 Internet, the security implications of your preferred method.
1106 The @command{rsh} and @command{telnet} methods send your password as
1107 plain text as you log in to the remote machine, as well as transferring
1108 the files in such a way that the content can easily be read from other
1111 If you need to connect to remote systems that are accessible from the
1112 Internet, you should give serious thought to using @command{ssh} based
1113 methods to connect. These provide a much higher level of security,
1114 making it a non-trivial exercise for someone to obtain your password or
1115 read the content of the files you are editing.
1117 @node Customizing Methods
1118 @section Using Non-Standard Methods
1119 @cindex customizing methods
1120 @cindex using non-standard methods
1121 @cindex create your own methods
1123 There is a variable @code{tramp-methods} which you can change if the
1124 predefined methods don't seem right.
1126 For the time being, I'll refer you to the Lisp documentation of that
1127 variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1130 @node Customizing Completion
1131 @section Selecting config files for user/host name completion
1132 @cindex customizing completion
1133 @cindex selecting config files
1134 @vindex tramp-completion-function-alist
1136 The variable @code{tramp-completion-function-alist} is intended to
1137 customize, which files are taken into account for user and host name
1138 completion (@pxref{Filename completion}). For every method, it keeps
1139 a set of configuration files, accompanied by a Lisp function able to
1140 parse that file. Entries in @code{tramp-completion-function-alist}
1141 have the form (@var{method} @var{pair1} @var{pair2} ...).
1143 Each @var{pair} is composed of (@var{function} @var{file}).
1144 @var{function} is responsible to extract user names and host names
1145 from @var{file} for completion. There are two functions which access
1148 @defun tramp-get-completion-function method
1149 This function returns the list of completion functions for @var{method}.
1153 (tramp-get-completion-function "rsh")
1155 @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1156 (tramp-parse-rhosts "~/.rhosts"))
1160 @defun tramp-set-completion-function method function-list
1161 This function sets @var{function-list} as list of completion functions
1166 (tramp-set-completion-function "ssh"
1167 '((tramp-parse-shosts "/etc/ssh_known_hosts")
1168 (tramp-parse-shosts "~/.ssh/known_hosts")))
1170 @result{} ((tramp-parse-shosts "/etc/ssh_known_hosts")
1171 (tramp-parse-shosts "~/.ssh/known_hosts"))
1175 The following predefined functions parsing configuration files exists:
1178 @item @code{tramp-parse-rhosts}
1179 @findex tramp-parse-rhosts
1181 This function parses files which are syntactical equivalent to
1182 @file{~/.rhosts}. It returns both host names and user names, if
1185 @item @code{tramp-parse-shosts}
1186 @findex tramp-parse-shosts
1188 This function parses files which are syntactical equivalent to
1189 @file{/etc/ssh_known_hosts}. Since there are no user names specified
1190 in such files, it can return host names only.
1192 @item @code{tramp-parse-hosts}
1193 @findex tramp-parse-hosts
1195 A function dedicated to @file{/etc/hosts} style files. It returns
1198 @item @code{tramp-parse-passwd}
1199 @findex tramp-parse-passwd
1201 A function which parses @file{/etc/passwd} like files. Obviously, it
1202 can return user names only.
1204 @item @code{tramp-parse-netrc}
1205 @findex tramp-parse-netrc
1207 Finally, a function which parses @file{~/.netrc} like files.
1210 If you want to keep your own data in a file, with your own structure,
1211 you might provide such a function as well. This function must meet
1212 the following conventions:
1214 @defun my-tramp-parse file
1215 @var{file} must be either a file name on your host, or @code{nil}. The
1216 function must return a list of (@var{user} @var{host}), which are
1217 taken as candidates for user and host name completion.
1221 (my-tramp-parse "~/.my-tramp-hosts")
1223 @result{} ((nil "toto") ("daniel" "melancholia"))
1228 @node Remote Programs
1229 @section How @tramp{} finds and uses programs on the remote machine.
1231 @tramp{} depends on a number of programs on the remote host in order to
1232 function, including @command{ls}, @command{test}, @command{find} and
1235 In addition to these required tools, there are various tools that may be
1236 required based on the connection method. See @ref{Inline methods} and
1237 @ref{External transfer methods} for details on these.
1239 Certain other tools, such as @command{perl} (or @command{perl5}) and
1240 @command{grep} will be used if they can be found. When they are
1241 available, they are used to improve the performance and accuracy of
1244 @vindex tramp-remote-path
1245 When @tramp{} connects to the remote machine, it searches for the
1246 programs that it can use. The variable @var{tramp-remote-path} controls
1247 the directories searched on the remote machine.
1249 By default, this is set to a reasonable set of defaults for most
1250 machines. It is possible, however, that your local (or remote ;) system
1251 administrator has put the tools you want in some obscure local
1254 In this case, you can still use them with @tramp{}. You simply need to
1255 add code to your @file{.emacs} to add the directory to the remote path.
1256 This will then be searched by @tramp{} when you connect and the software
1259 To add a directory to the remote search path, you could use code such
1263 @i{;; We load @tramp{} to define the variable.}
1265 @i{;; We have @command{perl} in "/usr/local/perl/bin"}
1266 (add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1270 @node Remote shell setup
1271 @comment node-name, next, previous, up
1272 @section Remote shell setup hints
1273 @cindex remote shell setup
1274 @cindex @file{.profile} file
1275 @cindex @file{.login} file
1276 @cindex shell init files
1278 As explained in the @ref{Overview} section, @tramp{} connects to the
1279 remote host and talks to the shell it finds there. Of course, when you
1280 log in, the shell executes its init files. Suppose your init file
1281 requires you to enter the birth date of your mother; clearly @tramp{}
1282 does not know this and hence fails to log you in to that host.
1284 There are different possible strategies for pursuing this problem. One
1285 strategy is to enable @tramp{} to deal with all possible situations.
1286 This is a losing battle, since it is not possible to deal with
1287 @emph{all} situations. The other strategy is to require you to set up
1288 the remote host such that it behaves like @tramp{} expect. This might
1289 be inconvenient because you have to invest a lot of effort into shell
1290 setup before you can begin to use @tramp{}.
1292 The package, therefore, pursues a combined approach. It tries to figure
1293 out some of the more common setups, and only requires you to avoid
1294 really exotic stuff. For example, it looks through a list of
1295 directories to find some programs on the remote host. And also, it
1296 knows that it is not obvious how to check whether a file exist, and
1297 therefore it tries different possibilities. (On some hosts and shells,
1298 the command @code{test -e} does the trick, on some hosts the shell
1299 builtin doesn't work but the program @code{/usr/bin/test -e} or
1300 @code{/bin/test -e} works. And on still other hosts, @code{ls -d} is
1301 the right way to do this.)
1303 Below you find a discussion of a few things that @tramp{} does not deal
1304 with, and that you therefore have to set up correctly.
1307 @item @var{shell-prompt-pattern}
1308 @vindex shell-prompt-pattern
1310 After logging in to the remote host, @tramp{} has to wait for the remote
1311 shell startup to finish before it can send commands to the remote
1312 shell. The strategy here is to wait for the shell prompt. In order to
1313 recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1314 to be set correctly to recognize the shell prompt on the remote host.
1316 Note that Tramp requires the match for @code{shell-prompt-pattern} to
1317 be at the end of the buffer. Many people have something like the
1318 following as the value for the variable: @code{"^[^>$][>$] *"}. Now
1319 suppose your shell prompt is @code{a <b> c $ }. In this case, Tramp
1320 recognizes the @code{>} character as the end of the prompt, but it is
1321 not at the end of the buffer.
1323 @item @var{tramp-shell-prompt-pattern}
1324 @vindex tramp-shell-prompt-pattern
1326 This regular expression is used by @tramp{} in the same way as
1327 @code{shell-prompt-pattern}, to match prompts from the remote shell.
1328 This second variable exists because the prompt from the remote shell
1329 might be different from the prompt from a local shell --- after all,
1330 the whole point of @tramp{} is to log in to remote hosts as a
1331 different user. The default value of
1332 @code{tramp-shell-prompt-pattern} is the same as the default value of
1333 @code{shell-prompt-pattern}, which is reported to work well in many
1336 @item @code{tset} and other questions
1337 @cindex Unix command tset
1338 @cindex tset Unix command
1340 Some people invoke the @code{tset} program from their shell startup
1341 scripts which asks the user about the terminal type of the shell.
1342 Maybe some shells ask other questions when they are started. @tramp{}
1343 does not know how to answer these questions. There are two approaches
1344 for dealing with this problem. One approach is to take care that the
1345 shell does not ask any questions when invoked from @tramp{}. You can
1346 do this by checking the @code{TERM} environment variable, it will be
1347 set to @code{dumb} when connecting.
1349 @vindex tramp-terminal-type
1350 The variable @code{tramp-terminal-type} can be used to change this value
1353 The other approach is to teach @tramp{} about these questions. See
1354 the variables @code{tramp-actions-before-shell} and
1355 @code{tramp-multi-actions} (for multi-hop connections).
1360 @node Windows setup hints
1361 @section Issues with Cygwin ssh
1362 @cindex Cygwin, issues
1364 This section needs a lot of work! Please help.
1366 @cindex method smx with Cygwin
1367 @cindex smx method with Cygwin
1368 If you use the Cygwin installation of ssh (you have to explicitly select
1369 it in the installer), then it should work out of the box to just select
1370 @code{smx} as the connection method. You can find information about
1371 setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}.
1375 @chapter Using @tramp
1376 @cindex using @tramp
1378 Once you have installed @tramp{} it will operate fairly transparently. You
1379 will be able to access files on any remote machine that you can log in
1380 to as though they were local.
1382 Files are specified to @tramp{} using a formalized syntax specifying the
1383 details of the system to connect to. This is similar to the syntax used
1384 by the @value{ftp-package-name} package.
1387 Something that might happen which surprises you is that Emacs
1388 remembers all your keystrokes, so if you see a password prompt from
1389 Emacs, say, and hit @kbd{@key{RET}} twice instead of once, then the
1390 second keystroke will be processed by Emacs after @tramp{} has done
1391 its thing. Why, this type-ahead is normal behavior, you say. Right
1392 you are, but be aware that opening a remote file might take quite a
1393 while, maybe half a minute when a connection needs to be opened.
1394 Maybe after half a minute you have already forgotten that you hit that
1398 * Filename Syntax:: @tramp{} filename conventions.
1399 * Multi-hop filename syntax:: Multi-hop filename conventions.
1400 * Filename completion:: Filename completion.
1405 @node Filename Syntax
1406 @section @tramp{} filename conventions
1407 @cindex filename syntax
1408 @cindex filename examples
1410 To access the file @var{path} on the remote machine @var{machine} you
1411 would specify the filename
1412 @file{@value{tramp-prefix}@var{machine}@value{tramp-postfix}@var{path}}.
1413 This will connect to @var{machine} and transfer the file using the
1414 default method. @xref{Default Method}.
1416 Some examples of @tramp{} filenames are shown below.
1419 @item @value{tramp-prefix}melancholia@value{tramp-postfix}.emacs
1420 Edit the file @file{.emacs} in your home directory on the machine
1423 @item @value{tramp-prefix}melancholia.danann.net@value{tramp-postfix}.emacs
1424 This edits the same file, using the fully qualified domain name of
1427 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~/.emacs
1428 This also edits the same file --- the @file{~} is expanded to your
1429 home directory on the remote machine, just like it is locally.
1431 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~daniel/.emacs
1432 This edits the file @file{.emacs} in the home directory of the user
1433 @code{daniel} on the machine @code{melancholia}. The @file{~<user>}
1434 construct is expanded to the home directory of that user on the remote
1437 @item @value{tramp-prefix}melancholia@value{tramp-postfix}/etc/squid.conf
1438 This edits the file @file{/etc/squid.conf} on the machine
1443 Unless you specify a different name to use, @tramp{} will use the
1444 current local user name as the remote user name to log in with. If you
1445 need to log in as a different user, you can specify the user name as
1446 part of the filename.
1448 To log in to the remote machine as a specific user, you use the syntax
1449 @file{@value{tramp-prefix}@var{user}@@@var{machine}@value{tramp-postfix}/@var{path/to.file}}.
1450 That means that connecting to @code{melancholia} as @code{daniel} and
1451 editing @file{.emacs} in your home directory you would specify
1452 @file{@value{tramp-prefix}daniel@@melancholia@value{tramp-postfix}.emacs}.
1454 It is also possible to specify other file transfer methods
1455 (@pxref{Default Method}) as part of the filename.
1457 This is done by putting the method before the user and host name, as
1459 @file{@value{tramp-prefix}@var{method}@value{tramp-postfix-single-hop}}
1460 (note the trailing colon).
1463 This is done by replacing the initial
1464 @file{@value{tramp-prefix}} with
1465 @file{@value{tramp-prefix}<method>@value{tramp-postfix-single-hop}}.
1466 (Note the trailing slash!).
1468 The user, machine and file specification remain the same.
1470 So, to connect to the machine @code{melancholia} as @code{daniel},
1471 using the @option{su} method to transfer files, and edit @file{.emacs}
1472 in my home directory I would specify the filename
1473 @file{@value{tramp-prefix}su@value{tramp-postfix-single-hop}daniel@@melancholia@value{tramp-postfix}.emacs}.
1476 @node Multi-hop filename syntax
1477 @section Multi-hop filename conventions
1478 @cindex filename syntax for multi-hop files
1479 @cindex multi-hop filename syntax
1481 The syntax of multi-hop file names is necessarily slightly different
1482 than the syntax of other @tramp{} file names. Here's an example
1483 multi-hop file name, first in Emacs syntax and then in XEmacs syntax:
1486 @value{tramp-prefix}multi@value{tramp-postfix-single-hop}rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host@value{tramp-postfix}/path/to.file
1489 This is quite a mouthful. So let's go through it step by step. The
1490 file name consists of three parts.
1492 The parts are separated by colons
1495 The parts are separated by slashes and square brackets.
1497 The first part is @file{@value{tramp-prefix}multi}, the method
1498 specification. The second part is
1499 @file{rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host}
1500 and specifies the hops. The final part is @file{/path/to.file} and
1501 specifies the file name on the remote host.
1503 The first part and the final part should be clear. @ref{Multi-hop
1504 Methods}, for a list of alternatives for the method specification.
1506 The second part can be subdivided again into components, so-called
1507 hops. In the above file name, there are two hops,
1508 @file{rsh@value{tramp-postfix-multi-hop}out@@gate} and
1509 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}.
1511 Each hop can @emph{again} be subdivided into (three) components, the
1512 @dfn{hop method}, the @dfn{user name} and the @dfn{host name}. The
1513 meaning of the second and third component should be clear, and the hop
1514 method says what program to use to perform that hop.
1516 The first hop, @file{rsh@value{tramp-postfix-multi-hop}out@@gate},
1517 says to use @command{rsh} to log in as user @code{out} to the host
1518 @code{gate}. Starting at that host, the second hop,
1519 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}, says to
1520 use @command{telnet} to log in as user @code{kai} to host
1523 @xref{Multi-hop Methods}, for a list of possible hop method values.
1524 The variable @code{tramp-multi-connection-function-alist} contains the
1525 list of possible hop methods and information on how to execute them,
1526 should you want to add your own.
1529 @node Filename completion
1530 @section Filename completion
1531 @cindex filename completion
1533 Filename completion works with @tramp{} for both completing methods,
1534 user names and machine names (except multi hop methods) as well as for
1535 files on remote machines.
1537 If you, for example, type @kbd{C-x C-f @value{tramp-prefix}t
1538 @key{TAB}}, @tramp{} might give you as result the choice for
1542 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop} tmp/
1543 @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1546 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop} @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1550 @samp{@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}}
1551 is a possible completion for the respective method,
1553 @samp{tmp/} stands for the directory @file{/tmp} on your local
1556 and @samp{@value{tramp-prefix-single-hop}toto@value{tramp-postfix}}
1557 might be a host @tramp has detected in your @file{~/.ssh/known_hosts}
1558 file (given you're using default method @option{ssh}).
1560 If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
1561 @samp{@value{tramp-prefix}telnet@value{tramp-postfix-single-hop}}.
1562 Next @kbd{@key{TAB}} brings you all machine names @tramp{} detects in
1563 your @file{/etc/hosts} file, let's say
1566 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}127.0.0.1@value{tramp-postfix} @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}192.168.0.1@value{tramp-postfix}
1567 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}localhost@value{tramp-postfix} @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia.danann.net@value{tramp-postfix}
1568 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia@value{tramp-postfix}
1571 Now you can choose the desired machine, and you can continue to
1572 complete file names on that machine.
1574 As filename completion needs to fetch the listing of files from the
1575 remote machine, this feature is sometimes fairly slow. As @tramp{}
1576 does not yet cache the results of directory listing, there is no gain
1577 in performance the second time you complete filenames.
1579 If the configuration files (@pxref{Customizing Completion}), which
1580 @tramp{} uses for analysis of completion, offer user names, those user
1581 names will be taken into account as well.
1588 @tramp{} works transparently with dired, enabling you to use this powerful
1589 file management tool to manage files on any machine you have access to
1592 If you need to browse a directory tree, Dired is a better choice, at
1593 present, than filename completion. Dired has its own cache mechanism
1594 and will only fetch the directory listing once.
1598 @chapter Reporting Bugs and Problems
1601 Bugs and problems with @tramp{} are actively worked on by the development
1602 team. Feature requests and suggestions are also more than welcome.
1604 The @tramp{} mailing list is a great place to get information on working
1605 with @tramp{}, solving problems and general discussion and advice on topics
1606 relating to the package.
1608 The mailing list is at @email{tramp-devel@@mail.freesoftware.fsf.org}.
1609 Messages sent to this address go to all the subscribers. This is
1610 @emph{not} the address to send subscription requests to.
1612 For help on subscribing to the list, send mail to the administrative
1613 address, @email{tramp-devel-request@@mail.freesoftware.fsf.org}, with the
1614 subject @samp{help}.
1616 To report a bug in @tramp{}, you should execute @kbd{M-x tramp-bug}. This
1617 will automatically generate a buffer with the details of your system and
1620 When submitting a bug report, please try to describe in excruciating
1621 detail the steps required to reproduce the problem, the setup of the
1622 remote machine and any special conditions that exist.
1624 If you can identify a minimal test case that reproduces the problem,
1625 include that with your bug report. This will make it much easier for the
1626 development team to analyze and correct the problem.
1628 @node Frequently Asked Questions
1629 @chapter Frequently Asked Questions
1630 @cindex frequently asked questions
1635 Where can I get the latest @tramp{}?
1637 @tramp{} is available under the URL below.
1640 @uref{ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz}
1643 There is also a Savannah project page.
1646 @uref{https://savannah.gnu.org/projects/tramp/}
1649 Which systems does it work on?
1651 The package has been used successfully on Emacs 20 and Emacs 21, as well
1652 as XEmacs 21. XEmacs 20 is more problematic, see the notes in
1653 @file{tramp.el}. I don't think anybody has really tried it on Emacs 19.
1655 The package was intended to work on Unix, and it really expects a
1656 Unix-like system on the remote end, but some people seemed to have some
1657 success getting it to work on NT Emacs.
1659 There are some informations on Tramp on NT at the following URL; many
1660 thanks to Joe Stoy for providing the information:
1661 @uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}
1663 The above mostly contains patches to old ssh versions; Tom Roche has a
1664 Web page with instructions:
1665 @uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
1667 ??? Is the XEmacs info correct?
1669 ??? Can somebody provide some information for getting it to work on NT
1670 Emacs? I think there was some issue with @command{ssh}?
1674 I can't stop EFS starting with XEmacs
1676 Not all the older versions of @tramp{} supported XEmacs correctly. The
1677 first thing to do is to make sure that you have the latest version of
1680 If you do, please try and find out exactly the conditions required for
1681 the EFS handlers to fire. If you can, putting a breakpoint on
1682 @code{efs-ftp-path} and sending in the stack trace along with your bug
1683 report would make it easier for the developers to work out what is
1688 File name completion does not work with @tramp{}
1690 When you log in to the remote machine, do you see the output of
1691 @command{ls} in color? If so, this may be the cause of your problems.
1693 @command{ls} outputs @acronym{ANSI} escape sequences that your terminal
1694 emulator interprets to set the colors. These escape sequences will
1695 confuse @tramp{} however.
1697 In your @file{.bashrc}, @file{.profile} or equivalent on the remote
1698 machine you probably have an alias configured that adds the option
1699 @option{--color=yes} or @option{--color=auto}.
1701 You should remove that alias and ensure that a new login @emph{does not}
1702 display the output of @command{ls} in color. If you still cannot use
1703 filename completion, report a bug to the @tramp{} developers.
1707 File name completion does not work in large directories
1709 @tramp{} uses globbing for some operations. (Globbing means to use the
1710 shell to expand wildcards such as `*.c'.) This might create long
1711 command lines, especially in directories with many files. Some shell
1712 choke on long command lines, or don't cope well with the globbing
1715 If you have a large directory on the remote end, you may wish to execute
1716 a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
1717 Note that you must first start the right shell, which might be
1718 @command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
1719 of those supports tilde expansion.
1723 What kinds of systems does @tramp{} work on
1725 @tramp{} really expects the remote system to be a Unix-like system. The
1726 local system should preferably be Unix-like, as well, but @tramp{} might
1727 work on NT with some tweaking.
1731 How can I get notified when @tramp{} file transfers are complete?
1733 The following snippet can be put in your @file{~/.emacs} file. It makes
1734 Emacs beep after reading from or writing to the remote host.
1737 (defadvice tramp-handle-write-region
1738 (after tramp-write-beep-advice activate)
1739 " make tramp beep after writing a file."
1742 (defadvice tramp-handle-do-copy-or-rename-file
1743 (after tramp-copy-beep-advice activate)
1744 " make tramp beep after copying a file."
1747 (defadvice tramp-handle-insert-file-contents
1748 (after tramp-copy-beep-advice activate)
1749 " make tramp beep after copying a file."
1756 There's this @file{~/.sh_history} file on the remote host which keeps
1757 growing and growing. What's that?
1759 Sometimes, @tramp{} starts @code{ksh} on the remote host for tilde
1760 expansion. Maybe @code{ksh} saves the history by default. @tramp{}
1761 tries to turn off saving the history, but maybe you have to help. For
1762 example, you could put this in your @file{.kshrc}:
1765 if [ -f $HOME/.sh_history ] ; then
1766 /bin/rm $HOME/.sh_history
1768 if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
1771 if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
1779 @c For the developer
1780 @node Version Control
1781 @chapter The inner workings of remote version control
1783 Unlike @value{ftp-package-name}, @tramp{} has full shell access to the
1784 remote machine. This makes it possible to provide version control for
1785 files accessed under @tramp{}.
1787 The actual version control binaries must be installed on the remote
1788 machine, accessible in the directories specified in
1789 @var{tramp-remote-path}.
1791 This transparent integration with the version control systems is one of
1792 the most valuable features provided by @tramp{}, but it is far from perfect.
1793 Work is ongoing to improve the transparency of the system.
1796 * Version Controlled Files:: Determining if a file is under version control.
1797 * Remote Commands:: Executing the version control commands on the remote machine.
1798 * Changed workfiles:: Detecting if the working file has changed.
1799 * Checking out files:: Bringing the workfile out of the repository.
1800 * Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
1804 @node Version Controlled Files
1805 @section Determining if a file is under version control
1807 The VC package uses the existence of on-disk revision control master
1808 files to determine if a given file is under revision control. These file
1809 tests happen on the remote machine through the standard @tramp{} mechanisms.
1812 @node Remote Commands
1813 @section Executing the version control commands on the remote machine
1815 There are no hooks provided by VC to allow intercepting of the version
1816 control command execution. The calls occur through the
1817 @code{call-process} mechanism, a function that is somewhat more
1818 efficient than the @code{shell-command} function but that does not
1819 provide hooks for remote execution of commands.
1821 To work around this, the functions @code{vc-do-command} and
1822 @code{vc-simple-command} have been advised to intercept requests for
1823 operations on files accessed via @tramp{}.
1825 In the case of a remote file, the @code{shell-command} interface is
1826 used, with some wrapper code, to provide the same functionality on the
1827 remote machine as would be seen on the local machine.
1830 @node Changed workfiles
1831 @section Detecting if the working file has changed
1833 As there is currently no way to get access to the mtime of a file on a
1834 remote machine in a portable way, the @code{vc-workfile-unchanged-p}
1835 function is advised to call an @tramp{} specific function for remote files.
1837 The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
1838 diff functionality to determine if any changes have occurred between the
1839 workfile and the version control master.
1841 This requires that a shell command be executed remotely, a process that
1842 is notably heavier-weight than the mtime comparison used for local
1843 files. Unfortunately, unless a portable solution to the issue is found,
1844 this will remain the cost of remote version control.
1847 @node Checking out files
1848 @section Bringing the workfile out of the repository
1850 VC will, by default, check for remote files and refuse to act on them
1851 when checking out files from the repository. To work around this
1852 problem, the function @code{vc-checkout} knows about @tramp{} files and
1853 allows version control to occur.
1856 @node Miscellaneous Version Control
1857 @section Things related to Version Control that don't fit elsewhere
1859 Minor implementation details, &c.
1862 * Remote File Ownership:: How VC determines who owns a workfile.
1863 * Back-end Versions:: How VC determines what release your RCS is.
1867 @node Remote File Ownership
1868 @subsection How VC determines who owns a workfile
1870 Emacs provides the @code{user-full-name} function to return the login name
1871 of the current user as well as mapping from arbitrary user id values
1872 back to login names. The VC code uses this functionality to map from the
1873 uid of the owner of a workfile to the login name in some circumstances.
1875 This will not, for obvious reasons, work if the remote system has a
1876 different set of logins. As such, it is necessary to delegate to the
1877 remote machine the job of determining the login name associated with a
1880 Unfortunately, with the profusion of distributed management systems such
1881 as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
1882 reliable and portable method for performing this mapping.
1884 Thankfully, the only place in the VC code that depends on the mapping of
1885 a uid to a login name is the @code{vc-file-owner} function. This returns
1886 the login of the owner of the file as a string.
1888 This function has been advised to use the output of @command{ls} on the
1889 remote machine to determine the login name, delegating the problem of
1890 mapping the uid to the login to the remote system which should know more
1894 @node Back-end Versions
1895 @subsection How VC determines what release your RCS is
1897 VC needs to know what release your revision control binaries you are
1898 running as not all features VC supports are available with older
1899 versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.
1901 The default implementation of VC determines this value the first time it
1902 is needed and then stores the value globally to avoid the overhead of
1903 executing a process and parsing its output each time the information is
1906 Unfortunately, life is not quite so easy when remote version control
1907 comes into the picture. Each remote machine may have a different version
1908 of the version control tools and, while this is painful, we need to
1909 ensure that unavailable features are not used remotely.
1911 To resolve this issue, @tramp{} currently takes the sledgehammer
1912 approach of making the release values of the revision control tools
1913 local to each @tramp{} buffer, forcing VC to determine these values
1914 again each time a new file is visited.
1916 This has, quite obviously, some performance implications. Thankfully,
1917 most of the common operations performed by VC do not actually require
1918 that the remote version be known. This makes the problem far less
1921 Eventually these values will be captured by @tramp{} on a system by
1922 system basis and the results cached to improve performance.
1925 @node Files directories and paths
1926 @chapter How file names, directories and paths are mangled and managed.
1929 * Path deconstruction:: Breaking a path into its components.
1933 @node Path deconstruction
1934 @section Breaking a path into its components.
1936 @tramp{} filenames are somewhat different, obviously, to ordinary path
1937 names. As such, the lisp functions @code{file-name-directory} and
1938 @code{file-name-nondirectory} are overridden within the @tramp{} package.
1940 Their replacements are reasonably simplistic in their approach. They
1941 dissect the filename, call the original handler on the remote path and
1942 then rebuild the @tramp{} path with the result.
1944 This allows the platform specific hacks in the original handlers to take
1945 effect while preserving the @tramp{} path information.
1949 @chapter Debatable Issues and What Was Decided
1952 @item The uuencode method does not always work.
1954 Due to the design of @tramp{}, the encoding and decoding programs need to
1955 read from stdin and write to stdout. On some systems, @code{uudecode -o
1956 -} will read stdin and write the decoded file to stdout, on other
1957 systems @code{uudecode -p} does the same thing. But some systems have
1958 uudecode implementations which cannot do this at all---it is not
1959 possible to call these uudecode implementations with suitable parameters
1960 so that they write to stdout.
1962 Of course, this could be circumvented: the @code{begin foo 644} line
1963 could be rewritten to put in some temporary file name, then
1964 @code{uudecode} could be called, then the temp file could be printed and
1967 But I have decided that this is too fragile to reliably work, so on some
1968 systems you'll have to do without the uuencode methods.
1970 @item @tramp{} does not work on XEmacs 20.
1972 This is because it requires the macro @code{with-timeout} which does not
1973 appear to exist in XEmacs 20. I'm somewhat reluctant to add an
1974 emulation macro to @tramp{}, but if somebody who uses XEmacs 20 steps
1975 forward and wishes to implement and test it, please contact me or the
1978 @item The @tramp{} filename syntax differs between Emacs and XEmacs.
1980 The Emacs maintainers wish to use a unified filename syntax for
1981 Ange-FTP and @tramp{} so that users don't have to learn a new
1982 syntax. It is sufficient to learn some extensions to the old syntax.
1984 For the XEmacs maintainers, the problems caused from using a unified
1985 filename syntax are greater than the gains. The XEmacs package
1986 system uses EFS for downloading new packages. So, obviously, EFS has
1987 to be installed from the start. If the filenames were unified, Tramp
1988 would have to be installed from the start, too.
1993 @c End of tramp.texi - the TRAMP User Manual
1998 @c * Say something about the .login and .profile files of the remote
2000 @c * Explain how tramp.el works in principle: open a shell on a remote
2001 @c host and then send commands to it.
2002 @c * Mention that bookmarks are a cool feature to go along with Tramp.
2003 @c * Make terminology "inline" vs "out-of-band" consistent.
2004 @c It seems that "external" is also used instead of "out-of-band".
2007 @c ** Use `filename' resp. `file name' consistently.
2008 @c ** Use `host' resp. `machine' consistently.
2009 @c ** Consistent small or capitalized words especially in menues.