1 \input texinfo @c -*-texinfo-*-
2 @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
12 @c configure.ac, so you should edit that file and run
13 @c "autoconf && ./configure" to change the version number.
15 @c Additionally, flags are set with respect to the Emacs flavor; and
16 @c depending whether Tramp is packaged into (X)Emacs, or standalone.
18 @include trampver.texi
20 @c Macro for formatting a filename according to the repective syntax.
21 @c xxx and yyy are auxiliary macros in order to omit leading and
22 @c trailing whitespace. Not very elegant, but I don't know it better.
28 @macro yyy {one, two}@c
36 @macro trampfn {method, user, host, localname}@c
37 @value{prefix}@yyy{\method\,@value{postfixhop}}@yyy{\user\,@@}\host\@value{postfix}\localname\@c
41 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
42 2007 Free Software Foundation, Inc.
45 Permission is granted to copy, distribute and/or modify this document
46 under the terms of the GNU Free Documentation License, Version 1.2 or
47 any later version published by the Free Software Foundation; with no
48 Invariant Sections, with the Front-Cover texts being ``A GNU
49 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
50 license is included in the section entitled ``GNU Free Documentation
51 License'' in the Emacs manual.
53 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
54 this GNU Manual, like GNU software. Copies published by the Free
55 Software Foundation raise funds for GNU development.''
57 This document is part of a collection distributed under the GNU Free
58 Documentation License. If you want to distribute this document
59 separately from the collection, you can do so by adding a copy of the
60 license to the document, as described in section 6 of the license.
64 @c Entries for @command{install-info} to use
65 @dircategory @value{emacsname}
67 * TRAMP: (tramp). Transparent Remote Access, Multiple Protocol
68 @value{emacsname} remote file access via rsh and rcp.
74 @title @value{tramp} version @value{trampver} User Manual
76 @author by Daniel Pittman
77 @author based on documentation by Kai Gro@ss{}johann
88 @node Top, Overview, (dir), (dir)
89 @top @value{tramp} version @value{trampver} User Manual
91 This file documents @value{tramp} version @value{trampver}, a remote file
92 editing package for @value{emacsname}.
94 @value{tramp} stands for `Transparent Remote (file) Access, Multiple
95 Protocol'. This package provides remote file editing, similar to
96 @value{ftppackagename}.
98 The difference is that @value{ftppackagename} uses FTP to transfer
99 files between the local and the remote host, whereas @value{tramp} uses a
100 combination of @command{rsh} and @command{rcp} or other work-alike
101 programs, such as @command{ssh}/@command{scp}.
103 You can find the latest version of this document on the web at
104 @uref{http://www.gnu.org/software/tramp/}.
106 @c Pointer to the other Emacs flavor is necessary only in case of
107 @c standalone installation.
108 @ifset installchapter
109 The manual has been generated for @value{emacsname}.
111 If you want to read the info pages for @value{emacsothername}, you
112 should read in @ref{Installation} how to create them.
115 If you're using the other Emacs flavor, you should read the
116 @uref{@value{emacsotherfilename}, @value{emacsothername}} pages.
122 This manual is also available as a @uref{@value{japanesemanual},
123 Japanese translation}.
126 The latest release of @value{tramp} is available for
127 @uref{ftp://ftp.gnu.org/gnu/tramp/, download}, or you may see
128 @ref{Obtaining Tramp} for more details, including the CVS server
131 @value{tramp} also has a @uref{http://savannah.gnu.org/projects/tramp/,
132 Savannah Project Page}.
135 There is a mailing list for @value{tramp}, available at
136 @email{tramp-devel@@gnu.org}, and archived at
137 @uref{http://lists.gnu.org/archive/html/tramp-devel/, the
138 @value{tramp} Mail Archive}.
140 Older archives are located at
141 @uref{http://sourceforge.net/mailarchive/forum.php?forum=tramp-devel,
142 SourceForge Mail Archive} and
143 @uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/,
145 @c in HTML output, there's no new paragraph.
154 * Overview:: What @value{tramp} can and cannot do.
158 * Obtaining Tramp:: How to obtain @value{tramp}.
159 * History:: History of @value{tramp}.
160 @ifset installchapter
161 * Installation:: Installing @value{tramp} with your @value{emacsname}.
163 * Configuration:: Configuring @value{tramp} for use.
164 * Usage:: An overview of the operation of @value{tramp}.
165 * Bug Reports:: Reporting Bugs and Problems.
166 * Frequently Asked Questions:: Questions and answers from the mailing list.
167 * Function Index:: @value{tramp} functions.
168 * Variable Index:: User options and variables.
169 * Concept Index:: An item for each concept.
173 * Version Control:: The inner workings of remote version control.
174 * Files directories and localnames:: How file names, directories and localnames are mangled and managed.
175 * Traces and Profiles:: How to Customize Traces.
176 * Issues:: Debatable Issues and What Was Decided.
178 * GNU Free Documentation License:: The license for this documentation.
181 --- The Detailed Node Listing ---
183 @ifset installchapter
184 Installing @value{tramp} with your @value{emacsname}
186 * Installation parameters:: Parameters in order to control installation.
187 * Load paths:: How to plug-in @value{tramp} into your environment.
188 * Japanese manual:: Japanese manual.
192 Configuring @value{tramp} for use
194 * Connection types:: Types of connections made to remote machines.
195 * Inline methods:: Inline methods.
196 * External transfer methods:: External transfer methods.
198 * Gateway methods:: Gateway methods.
200 * Default Method:: Selecting a default method.
201 * Default User:: Selecting a default user.
202 * Default Host:: Selecting a default host.
203 * Multi-hops:: Connecting to a remote host using multiple hops.
204 * Customizing Methods:: Using Non-Standard Methods.
205 * Customizing Completion:: Selecting config files for user/host name completion.
206 * Password caching:: Reusing passwords for several connections.
207 * Connection caching:: Reusing connection related information.
208 * Remote Programs:: How @value{tramp} finds and uses programs on the remote machine.
209 * Remote shell setup:: Remote shell setup hints.
210 * Windows setup hints:: Issues with Cygwin ssh.
211 * Auto-save and Backup:: Auto-save and Backup.
215 * Filename Syntax:: @value{tramp} filename conventions.
216 * Alternative Syntax:: URL-like filename syntax.
217 * Filename completion:: Filename completion.
218 * Remote processes:: Integration with other @value{emacsname} packages.
219 * Cleanup remote connections:: Cleanup remote connections.
221 The inner workings of remote version control
223 * Version Controlled Files:: Determining if a file is under version control.
224 * Remote Commands:: Executing the version control commands on the remote machine.
225 * Changed workfiles:: Detecting if the working file has changed.
226 * Checking out files:: Bringing the workfile out of the repository.
227 * Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
229 Things related to Version Control that don't fit elsewhere
231 * Remote File Ownership:: How VC determines who owns a workfile.
232 * Back-end Versions:: How VC determines what release your RCS is.
234 How file names, directories and localnames are mangled and managed
236 * Localname deconstruction:: Breaking a localname into its components.
238 * External packages:: Integration with external Lisp packages.
245 @chapter An overview of @value{tramp}
248 After the installation of @value{tramp} into your @value{emacsname}, you
249 will be able to access files on remote machines as though they were
250 local. Access to the remote file system for editing files, version
251 control, and @code{dired} are transparently enabled.
253 Your access to the remote machine can be with the @command{rsh},
254 @command{rlogin}, @command{telnet} programs or with any similar
255 connection method. This connection must pass @acronym{ASCII}
256 successfully to be usable but need not be 8-bit clean.
258 The package provides support for @command{ssh} connections out of the
259 box, one of the more common uses of the package. This allows
260 relatively secure access to machines, especially if @command{ftp}
263 Under Windows, @value{tramp} is integrated with the PuTTY package,
264 using the @command{plink} program.
266 The majority of activity carried out by @value{tramp} requires only that
267 the remote login is possible and is carried out at the terminal. In
268 order to access remote files @value{tramp} needs to transfer their content
269 to the local machine temporarily.
271 @value{tramp} can transfer files between the machines in a variety of ways.
272 The details are easy to select, depending on your needs and the
273 machines in question.
275 The fastest transfer methods for large files rely on a remote file
276 transfer package such as @command{rcp}, @command{scp}, @command{rsync}
277 or (under Windows) @command{pscp}.
279 If the remote copy methods are not suitable for you, @value{tramp} also
280 supports the use of encoded transfers directly through the shell.
281 This requires that the @command{mimencode} or @command{uuencode} tools
282 are available on the remote machine. These methods are generally
283 faster for small files.
285 @value{tramp} is still under active development and any problems you encounter,
286 trivial or major, should be reported to the @value{tramp} developers.
290 @subsubheading Behind the scenes
291 @cindex behind the scenes
292 @cindex details of operation
295 This section tries to explain what goes on behind the scenes when you
296 access a remote file through @value{tramp}.
298 Suppose you type @kbd{C-x C-f} and enter part of an @value{tramp} file name,
299 then hit @kbd{@key{TAB}} for completion. Suppose further that this is
300 the first time that @value{tramp} is invoked for the host in question. Here's
305 @value{tramp} discovers that it needs a connection to the host. So it
306 invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
307 @var{user}} or a similar tool to connect to the remote host.
308 Communication with this process happens through an
309 @value{emacsname} buffer, that is, the output from the remote end
313 The remote host may prompt for a login name (for @command{telnet}).
314 The login name is given in the file name, so @value{tramp} sends the
315 login name and a newline.
318 The remote host may prompt for a password or pass phrase (for
319 @command{rsh} or for @command{telnet} after sending the login name).
320 @value{tramp} displays the prompt in the minibuffer, asking you for the
321 password or pass phrase.
323 You enter the password or pass phrase. @value{tramp} sends it to the remote
324 host, followed by a newline.
327 @value{tramp} now waits for the shell prompt or for a message that the login
330 If @value{tramp} sees neither of them after a certain period of time (a minute,
331 say), then it issues an error message saying that it couldn't find the
332 remote shell prompt and shows you what the remote host has sent.
334 If @value{tramp} sees a @samp{login failed} message, it tells you so,
335 aborts the login attempt and allows you to try again.
338 Suppose that the login was successful and @value{tramp} sees the shell prompt
339 from the remote host. Now @value{tramp} invokes @command{/bin/sh} because
340 Bourne shells and C shells have different command
341 syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
342 shell doesn't recognize @samp{exec /bin/sh} as a valid command.
343 Maybe you use the Scheme shell @command{scsh}@dots{}}
345 After the Bourne shell has come up, @value{tramp} sends a few commands to
346 ensure a good working environment. It turns off echoing, it sets the
347 shell prompt, and a few other things.
350 Now the remote shell is up and it good working order. Remember, what
351 was supposed to happen is that @value{tramp} tries to find out what files exist
352 on the remote host so that it can do filename completion.
354 So, @value{tramp} basically issues @command{cd} and @command{ls} commands and
355 also sometimes @command{echo} with globbing. Another command that is
356 often used is @command{test} to find out whether a file is writable or a
357 directory or the like. The output of each command is parsed for the
361 Suppose you are finished with filename completion, have entered @kbd{C-x
362 C-f}, a full file name and hit @kbd{@key{RET}}. Now comes the time to
363 transfer the file contents from the remote host to the local host so
364 that you can edit them.
366 See above for an explanation of how @value{tramp} transfers the file contents.
368 For inline transfers, @value{tramp} issues a command like @samp{mimencode -b
369 /path/to/remote/file}, waits until the output has accumulated in the
370 buffer that's used for communication, then decodes that output to
371 produce the file contents.
373 For out-of-band transfers, @value{tramp} issues a command like the following:
375 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
377 It then reads the local temporary file @file{/tmp/tramp.4711} into a
378 buffer and deletes the temporary file.
381 You now edit the buffer contents, blithely unaware of what has happened
382 behind the scenes. (Unless you have read this section, that is.) When
383 you are finished, you type @kbd{C-x C-s} to save the buffer.
386 Again, @value{tramp} transfers the file contents to the remote host either
387 inline or out-of-band. This is the reverse of what happens when reading
391 I hope this has provided you with a basic overview of what happens
392 behind the scenes when you open a file with @value{tramp}.
396 @node Obtaining Tramp
397 @chapter Obtaining Tramp.
398 @cindex obtaining Tramp
400 @value{tramp} is freely available on the Internet and the latest
401 release may be downloaded from
402 @uref{ftp://ftp.gnu.org/gnu/tramp/}. This release includes the full
403 documentation and code for @value{tramp}, suitable for installation.
404 But GNU Emacs (22 or later) includes @value{tramp} already, and there
405 is a @value{tramp} package for XEmacs, as well. So maybe it is easier
406 to just use those. But if you want the bleeding edge, read
409 For the especially brave, @value{tramp} is available from CVS. The CVS
410 version is the latest version of the code and may contain incomplete
411 features or new issues. Use these versions at your own risk.
413 Instructions for obtaining the latest development version of @value{tramp}
414 from CVS can be found by going to the Savannah project page at the
415 following URL and then clicking on the CVS link in the navigation bar
419 @uref{http://savannah.gnu.org/projects/tramp/}
422 Or follow the example session below:
425 ] @strong{cd ~/@value{emacsdir}}
426 ] @strong{export CVS_RSH="ssh"}
427 ] @strong{cvs -z3 -d:ext:anoncvs@@savannah.gnu.org:/cvsroot/tramp co tramp}
431 You should now have a directory @file{~/@value{emacsdir}/tramp}
432 containing the latest version of @value{tramp}. You can fetch the latest
433 updates from the repository by issuing the command:
436 ] @strong{cd ~/@value{emacsdir}/tramp}
437 ] @strong{export CVS_RSH="ssh"}
438 ] @strong{cvs update -d}
442 Once you've got updated files from the CVS repository, you need to run
443 @command{autoconf} in order to get an up-to-date @file{configure}
447 ] @strong{cd ~/@value{emacsdir}/tramp}
451 People who have no direct CVS access (maybe because sitting behind a
452 blocking firewall), can try the
453 @uref{http://savannah.gnu.org/cvs-backup/tramp-sources.tar.gz, Nightly
454 CVS Tree Tarball} instead of.
458 @chapter History of @value{tramp}
460 @cindex development history
462 Development was started end of November 1998. The package was called
463 @file{rssh.el}, back then. It only provided one method to access a
464 file, using @command{ssh} to log in to a remote host and using
465 @command{scp} to transfer the file contents. After a while, the name
466 was changed to @file{rcp.el}, and now it's @value{tramp}. Along the way,
467 many more methods for getting a remote shell and for transferring the
468 file contents were added. Support for VC was added.
470 The most recent addition of major features were the multi-hop methods
471 added in April 2000 and the unification of @value{tramp} and Ange-FTP
472 filenames in July 2002. In July 2004, multi-hop methods have been
473 replaced by proxy hosts. Running commands on remote hosts was
474 introduced in December 2005.
476 Support of gateways exists since April 2007.
479 In December 2001, @value{tramp} has been added to the XEmacs package
480 repository. Being part of the GNU Emacs repository happened in June
481 2002, the first release including @value{tramp} was GNU Emacs 22.1.
483 @value{tramp} is also a GNU/Linux Debian package since February 2001.
486 @c Installation chapter is necessary only in case of standalone
487 @c installation. Text taken from trampinst.texi.
488 @ifset installchapter
489 @include trampinst.texi
493 @chapter Configuring @value{tramp} for use
494 @cindex configuration
496 @cindex default configuration
497 @value{tramp} is (normally) fully functional when it is initially
498 installed. It is initially configured to use the @command{scp}
499 program to connect to the remote host. So in the easiest case, you
500 just type @kbd{C-x C-f} and then enter the filename
501 @file{@trampfn{, user, machine, /path/to.file}}.
503 On some hosts, there are problems with opening a connection. These are
504 related to the behavior of the remote shell. See @xref{Remote shell
505 setup}, for details on this.
507 If you do not wish to use these commands to connect to the remote
508 host, you should change the default connection and transfer method
509 that @value{tramp} uses. There are several different methods that @value{tramp}
510 can use to connect to remote machines and transfer files
511 (@pxref{Connection types}).
513 If you don't know which method is right for you, see @xref{Default
518 * Connection types:: Types of connections made to remote machines.
519 * Inline methods:: Inline methods.
520 * External transfer methods:: External transfer methods.
522 * Gateway methods:: Gateway methods.
524 * Default Method:: Selecting a default method.
525 Here we also try to help those who
526 don't have the foggiest which method
528 * Default User:: Selecting a default user.
529 * Default Host:: Selecting a default host.
530 * Multi-hops:: Connecting to a remote host using multiple hops.
531 * Customizing Methods:: Using Non-Standard Methods.
532 * Customizing Completion:: Selecting config files for user/host name completion.
533 * Password caching:: Reusing passwords for several connections.
534 * Connection caching:: Reusing connection related information.
535 * Remote Programs:: How @value{tramp} finds and uses programs on the remote machine.
536 * Remote shell setup:: Remote shell setup hints.
537 * Windows setup hints:: Issues with Cygwin ssh.
538 * Auto-save and Backup:: Auto-save and Backup.
542 @node Connection types
543 @section Types of connections made to remote machines.
544 @cindex connection types, overview
546 There are two basic types of transfer methods, each with its own
547 advantages and limitations. Both types of connection make use of a
548 remote shell access program such as @command{rsh}, @command{ssh} or
549 @command{telnet} to connect to the remote machine.
551 This connection is used to perform many of the operations that @value{tramp}
552 requires to make the remote file system transparently accessible from
553 the local machine. It is only when visiting files that the methods
556 @cindex inline methods
557 @cindex external transfer methods
558 @cindex external methods
559 @cindex out-of-band methods
560 @cindex methods, inline
561 @cindex methods, external transfer
562 @cindex methods, out-of-band
563 Loading or saving a remote file requires that the content of the file
564 be transfered between the two machines. The content of the file can be
565 transfered over the same connection used to log in to the remote
566 machine or the file can be transfered through another connection using
567 a remote copy program such as @command{rcp}, @command{scp} or
568 @command{rsync}. The former are called @dfn{inline methods}, the
569 latter are called @dfn{out-of-band methods} or @dfn{external transfer
570 methods} (@dfn{external methods} for short).
572 The performance of the external transfer methods is generally better
573 than that of the inline methods, at least for large files. This is
574 caused by the need to encode and decode the data when transferring
577 The one exception to this rule are the @command{scp} based transfer
578 methods. While these methods do see better performance when actually
579 transferring files, the overhead of the cryptographic negotiation at
580 startup may drown out the improvement in file transfer times.
582 External transfer methods should be configured such a way that they
583 don't require a password (with @command{ssh-agent}, or such alike).
584 Modern @command{scp} implementations offer options to reuse existing
585 @command{ssh} connections, see method @command{scpc}. If it isn't
586 possible, you should consider @ref{Password caching}, otherwise you
587 will be prompted for a password every copy action.
591 @section Inline methods
592 @cindex inline methods
593 @cindex methods, inline
595 The inline methods in @value{tramp} are quite powerful and can work in
596 situations where you cannot use an external transfer program to connect.
597 Inline methods are the only methods that work when connecting to the
598 remote machine via telnet. (There are also strange inline methods which
599 allow you to transfer files between @emph{user identities} rather than
602 These methods depend on the existence of a suitable encoding and
603 decoding command on remote machine. Locally, @value{tramp} may be able to
604 use features of @value{emacsname} to decode and encode the files or
605 it may require access to external commands to perform that task.
609 @cindex base-64 encoding
610 @value{tramp} checks the availability and usability of commands like
611 @command{mimencode} (part of the @command{metamail} package) or
612 @command{uuencode} on the remote host. The first reliable command
613 will be used. The search path can be customized, see @ref{Remote
616 If both commands aren't available on the remote host, @value{tramp}
617 transfers a small piece of Perl code to the remote host, and tries to
618 apply it for encoding and decoding.
626 Connect to the remote host with @command{rsh}. Due to the unsecure
627 connection it is recommended for very local host topology only.
629 On operating systems which provide the command @command{remsh} instead
630 of @command{rsh}, you can use the method @option{remsh}. This is true
631 for HP-UX or Cray UNICOS, for example.
638 Connect to the remote host with @command{ssh}. This is identical to
639 the previous option except that the @command{ssh} package is used,
640 making the connection more secure.
642 There are also two variants, @option{ssh1} and @option{ssh2}, that
643 call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
644 explicitly select whether you want to use the SSH protocol version 1
645 or 2 to connect to the remote host. (You can also specify in
646 @file{~/.ssh/config}, the SSH configuration file, which protocol
647 should be used, and use the regular @option{ssh} method.)
649 Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
650 @command{ssh1} and @command{ssh2} commands explicitly. If you don't
651 know what these are, you do not need these options.
653 All the methods based on @command{ssh} have an additional kludgy
654 feature: you can specify a host name which looks like @file{host#42}
655 (the real host name, then a hash sign, then a port number). This
656 means to connect to the given host but to also pass @code{-p 42} as
657 arguments to the @command{ssh} command.
660 @item @option{telnet}
661 @cindex method telnet
662 @cindex telnet method
664 Connect to the remote host with @command{telnet}. This is as unsecure
665 as the @option{rsh} method.
672 This method does not connect to a remote host at all, rather it uses
673 the @command{su} program to allow you to edit files as another user.
674 With other words, a specified host name in the file name is silently
682 This is similar to the @option{su} method, but it uses @command{sudo}
683 rather than @command{su} to become a different user.
685 Note that @command{sudo} must be configured to allow you to start a
686 shell as the user. It would be nice if it was sufficient if
687 @command{ls} and @command{mimencode} were allowed, but that is not
688 easy to implement, so I haven't got around to it, yet.
695 As you would expect, this is similar to @option{ssh}, only a little
696 different. Whereas @option{ssh} opens a normal interactive shell on
697 the remote host, this option uses @samp{ssh -t -t @var{host} -l
698 @var{user} /bin/sh} to open a connection. This is useful for users
699 where the normal login shell is set up to ask them a number of
700 questions when logging in. This procedure avoids these questions, and
701 just gives @value{tramp} a more-or-less `standard' login shell to work
704 Note that this procedure does not eliminate questions asked by
705 @command{ssh} itself. For example, @command{ssh} might ask ``Are you
706 sure you want to continue connecting?'' if the host key of the remote
707 host is not known. @value{tramp} does not know how to deal with such a
708 question (yet), therefore you will need to make sure that you can log
709 in without such questions.
711 This is also useful for Windows users where @command{ssh}, when
712 invoked from an @value{emacsname} buffer, tells them that it is not
713 allocating a pseudo tty. When this happens, the login shell is wont
714 to not print any shell prompt, which confuses @value{tramp} mightily.
715 For reasons unknown, some Windows ports for @command{ssh} require the
716 doubled @samp{-t} option.
718 This supports the @samp{-p} kludge.
721 @item @option{krlogin}
722 @cindex method krlogin
723 @cindex krlogin method
724 @cindex Kerberos (with krlogin method)
726 This method is also similar to @option{ssh}. It only uses the
727 @command{krlogin -x} command to log in to the remote host.
734 This method is mostly interesting for Windows users using the PuTTY
735 implementation of SSH. It uses @samp{plink -ssh} to log in to the
738 This supports the @samp{-P} kludge.
740 Additionally, the methods @option{plink1} and @option{plink2} are
741 provided, which call @samp{plink -1 -ssh} or @samp{plink -2 -ssh} in
742 order to use SSH protocol version 1 or 2 explicitly.
744 CCC: Do we have to connect to the remote host once from the command
745 line to accept the SSH key? Maybe this can be made automatic?
747 CCC: Say something about the first shell command failing. This might
748 be due to a wrong setting of @code{tramp-rsh-end-of-line}.
751 @item @option{plinkx}
752 @cindex method plinkx
753 @cindex plinkx method
755 Another method using PuTTY on Windows. Instead of host names, it
756 expects PuTTY session names, calling @samp{plink -load @var{session}
757 -t"}. User names are relevant only in case the corresponding session
758 hasn't defined a user name. Different port numbers must be defined in
766 This is an experimental implementation of the fish protocol, known from
767 the GNU Midnight Commander or the KDE Konqueror. @value{tramp} expects
768 the fish server implementation from the KDE kioslave. That means, the
769 file @file{~/.fishsrv.pl} is expected to reside on the remote host.
771 The implementation lacks good performance. The code is offered anyway,
772 maybe somebody can improve the performance.
777 @node External transfer methods
778 @section External transfer methods
779 @cindex methods, external transfer
780 @cindex methods, out-of-band
781 @cindex external transfer methods
782 @cindex out-of-band methods
784 The external transfer methods operate through multiple channels, using
785 the remote shell connection for many actions while delegating file
786 transfers to an external transfer utility.
788 This saves the overhead of encoding and decoding that multiplexing the
789 transfer through the one connection has with the inline methods.
791 Since external transfer methods need their own overhead opening a new
792 channel, all files which are smaller than @var{tramp-copy-size-limit}
793 are still transferred with the corresponding inline method. It should
794 provide a fair trade-off between both approaches.
797 @item @option{rcp} --- @command{rsh} and @command{rcp}
800 @cindex rcp (with rcp method)
801 @cindex rsh (with rcp method)
803 This method uses the @command{rsh} and @command{rcp} commands to connect
804 to the remote machine and transfer files. This is probably the fastest
805 connection method available.
807 The alternative method @option{remcp} uses the @command{remsh} and
808 @command{rcp} commands. It should be applied on machines where
809 @command{remsh} is used instead of @command{rsh}.
812 @item @option{scp} --- @command{ssh} and @command{scp}
815 @cindex scp (with scp method)
816 @cindex ssh (with scp method)
818 Using @command{ssh} to connect to the remote host and @command{scp} to
819 transfer files between the machines is the best method for securely
820 connecting to a remote machine and accessing files.
822 The performance of this option is also quite good. It may be slower than
823 the inline methods when you often open and close small files however.
824 The cost of the cryptographic handshake at the start of an @command{scp}
825 session can begin to absorb the advantage that the lack of encoding and
828 There are also two variants, @option{scp1} and @option{scp2}, that
829 call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
830 explicitly select whether you want to use the SSH protocol version 1
831 or 2 to connect to the remote host. (You can also specify in
832 @file{~/.ssh/config}, the SSH configuration file, which protocol
833 should be used, and use the regular @option{scp} method.)
835 Two other variants, @option{scp1_old} and @option{scp2_old}, use the
836 @command{ssh1} and @command{ssh2} commands explicitly. If you don't
837 know what these are, you do not need these options.
839 All the @command{ssh} based methods support the kludgy @samp{-p}
840 feature where you can specify a port number to connect to in the host
841 name. For example, the host name @file{host#42} tells @value{tramp} to
842 specify @samp{-p 42} in the argument list for @command{ssh}, and to
843 specify @samp{-P 42} in the argument list for @command{scp}.
846 @item @option{sftp} --- @command{ssh} and @command{sftp}
849 @cindex sftp (with sftp method)
850 @cindex ssh (with sftp method)
852 That is mostly the same method as @option{scp}, but using
853 @command{sftp} as transfer command. So the same remarks are valid.
855 This command does not work like @value{ftppackagename}, where
856 @command{ftp} is called interactively, and all commands are send from
857 within this session. Instead of, @command{ssh} is used for login.
859 This method supports the @samp{-p} hack.
862 @item @option{rsync} --- @command{ssh} and @command{rsync}
865 @cindex rsync (with rsync method)
866 @cindex ssh (with rsync method)
868 Using the @command{ssh} command to connect securely to the remote
869 machine and the @command{rsync} command to transfer files is almost
870 identical to the @option{scp} method.
872 While @command{rsync} performs much better than @command{scp} when
873 transferring files that exist on both hosts, this advantage is lost if
874 the file exists only on one side of the connection.
876 The @command{rsync} based method may be considerably faster than the
877 @command{rcp} based methods when writing to the remote system. Reading
878 files to the local machine is no faster than with a direct copy.
880 This method supports the @samp{-p} hack.
883 @item @option{scpx} --- @command{ssh} and @command{scp}
886 @cindex scp (with scpx method)
887 @cindex ssh (with scpx method)
889 As you would expect, this is similar to @option{scp}, only a little
890 different. Whereas @option{scp} opens a normal interactive shell on
891 the remote host, this option uses @samp{ssh -t -t @var{host} -l
892 @var{user} /bin/sh} to open a connection. This is useful for users
893 where the normal login shell is set up to ask them a number of
894 questions when logging in. This procedure avoids these questions, and
895 just gives @value{tramp} a more-or-less `standard' login shell to work
898 This is also useful for Windows users where @command{ssh}, when
899 invoked from an @value{emacsname} buffer, tells them that it is not
900 allocating a pseudo tty. When this happens, the login shell is wont
901 to not print any shell prompt, which confuses @value{tramp} mightily.
903 This method supports the @samp{-p} hack.
906 @item @option{scpc} --- @command{ssh} and @command{scp}
909 @cindex scp (with scpx method)
910 @cindex ssh (with scpx method)
912 Newer versions of @option{ssh} (for example OpenSSH 4) offer an option
913 @option{ControlMaster}. This allows @option{scp} to reuse an existing
914 @option{ssh} channel, which increases performance.
916 Before you use this method, you shall check whether your @option{ssh}
917 implementation does support this option. Try from the command line
920 ssh localhost -o ControlMaster=yes
923 This method supports the @samp{-p} hack.
926 @item @option{pscp} --- @command{plink} and @command{pscp}
929 @cindex pscp (with pscp method)
930 @cindex plink (with pscp method)
931 @cindex PuTTY (with pscp method)
933 This method is similar to @option{scp}, but it uses the
934 @command{plink} command to connect to the remote host, and it uses
935 @command{pscp} for transferring the files. These programs are part
936 of PuTTY, an SSH implementation for Windows.
938 This method supports the @samp{-P} hack.
941 @item @option{psftp} --- @command{plink} and @command{psftp}
944 @cindex psftp (with psftp method)
945 @cindex plink (with psftp method)
946 @cindex PuTTY (with psftp method)
948 As you would expect, this method is similar to @option{sftp}, but it
949 uses the @command{plink} command to connect to the remote host, and it
950 uses @command{psftp} for transferring the files. These programs are
951 part of PuTTY, an SSH implementation for Windows.
953 This method supports the @samp{-P} hack.
956 @item @option{fcp} --- @command{fsh} and @command{fcp}
959 @cindex fsh (with fcp method)
960 @cindex fcp (with fcp method)
962 This method is similar to @option{scp}, but it uses the @command{fsh}
963 command to connect to the remote host, and it uses @command{fcp} for
964 transferring the files. @command{fsh/fcp} are a front-end for
965 @command{ssh} which allow for reusing the same @command{ssh} session
966 for submitting several commands. This avoids the startup overhead of
967 @command{scp} (which has to establish a secure connection whenever it
968 is called). Note, however, that you can also use one of the inline
969 methods to achieve a similar effect.
971 This method uses the command @samp{fsh @var{host} -l @var{user}
972 /bin/sh -i} to establish the connection, it does not work to just say
973 @command{fsh @var{host} -l @var{user}}.
978 There is no inline method using @command{fsh} as the multiplexing
979 provided by the program is not very useful in our context. @value{tramp}
980 opens just one connection to the remote host and then keeps it open,
988 This is not a native @value{tramp} method. Instead of, it forwards all
989 requests to @value{ftppackagename}.
991 This works only for unified filenames, see @ref{Issues}.
995 @item @option{smb} --- @command{smbclient}
999 This is another not natural @value{tramp} method. It uses the
1000 @command{smbclient} command on different Unices in order to connect to
1001 an SMB server. An SMB server might be a Samba (or CIFS) server on
1002 another UNIX host or, more interesting, a host running MS Windows. So
1003 far, it is tested towards MS Windows NT, MS Windows 2000, and MS
1006 The first directory in the localname must be a share name on the remote
1007 host. Remember, that the @code{$} character in which default shares
1008 usually end, must be written @code{$$} due to environment variable
1009 substitution in file names. If no share name is given (i.e. remote
1010 directory @code{/}), all available shares are listed.
1012 Since authorization is done on share level, you will be prompted
1013 always for a password if you access another share on the same host.
1014 This can be suppressed by @ref{Password caching}.
1016 MS Windows uses for authorization both a user name and a domain name.
1017 Because of this, the @value{tramp} syntax has been extended: you can
1018 specify a user name which looks like @code{user%domain} (the real user
1019 name, then a percent sign, then the domain name). So, to connect to
1020 the machine @code{melancholia} as user @code{daniel} of the domain
1021 @code{BIZARRE}, and edit @file{.emacs} in the home directory (share
1022 @code{daniel$}) I would specify the filename @file{@trampfn{smb,
1023 daniel%BIZARRE, melancholia, /daniel$$/.emacs}}.
1025 Depending on the Windows domain configuration, a Windows user might be
1026 considered as domain user per default. In order to connect as local
1027 user, the WINS name of that machine must be given as domain name.
1028 Usually, it is the machine name in capital letters. In the example
1029 above, the local user @code{daniel} would be specified as
1030 @file{@trampfn{smb, daniel%MELANCHOLIA, melancholia, /daniel$$/.emacs}}.
1032 The domain name as well as the user name are optional. If no user
1033 name is specified at all, the anonymous user (without password
1034 prompting) is assumed. This is different from all other @value{tramp}
1035 methods, where in such a case the local user name is taken.
1037 The @option{smb} method supports the @samp{-p} hack.
1039 @strong{Please note:} If @value{emacsname} runs locally under MS
1040 Windows, this method isn't available. Instead of, you can use UNC
1041 file names like @file{//melancholia/daniel$$/.emacs}. The only
1042 disadvantage is that there's no possibility to specify another user
1049 @node Gateway methods
1050 @section Gateway methods
1051 @cindex methods, gateway
1052 @cindex gateway methods
1054 Gateway methods are not methods to access a remote host directly.
1055 These methods are intended to pass firewalls or proxy servers.
1056 Therefore, they can be used for proxy host declarations
1057 (@pxref{Multi-hops}) only.
1059 A gateway method must come always along with a method who supports
1060 port setting (referred to as @samp{-p} kludge). This is because
1061 @value{tramp} targets the accompanied method to
1062 @file{localhost#random_port}, from where the firewall or proxy server
1065 Gateway methods support user name and password declarations. These
1066 are used to authenticate towards the corresponding firewall or proxy
1067 server. They can be passed only if your friendly administrator has
1068 granted your access.
1071 @item @option{tunnel}
1072 @cindex method tunnel
1073 @cindex tunnel method
1075 This method implements an HTTP tunnel via the @command{CONNECT}
1076 command (see RFC 2616, 2817). Any HTTP 1.1 compliant (proxy) server
1077 shall support this command.
1079 As authentication method, only @option{Basic Authentication} (see RFC
1080 2617) is implemented so far. If no port number is given in the
1081 declaration, port @option{8080} is used for the proxy server.
1084 @item @option{socks}
1085 @cindex method socks
1086 @cindex socks method
1088 The @command{socks} method provides access to SOCKSv5 servers (see
1089 RFC 1928). @option{Username/Password Authentication} according to RFC
1092 The default port number of the socks server is @option{1080}, if not
1093 specified otherwise.
1099 @node Default Method
1100 @section Selecting a default method
1101 @cindex default method
1103 @vindex tramp-default-method
1104 When you select an appropriate transfer method for your typical usage
1105 you should set the variable @code{tramp-default-method} to reflect that
1106 choice. This variable controls which method will be used when a method
1107 is not specified in the @value{tramp} file name. For example:
1110 (setq tramp-default-method "ssh")
1113 @vindex tramp-default-method-alist
1114 You can also specify different methods for certain user/host
1115 combinations, via the variable @code{tramp-default-method-alist}. For
1116 example, the following two lines specify to use the @option{ssh}
1117 method for all user names matching @samp{john} and the @option{rsync}
1118 method for all host names matching @samp{lily}. The third line
1119 specifies to use the @option{su} method for the user @samp{root} on
1120 the machine @samp{localhost}.
1123 (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
1124 (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1125 (add-to-list 'tramp-default-method-alist
1126 '("\\`localhost\\'" "\\`root\\'" "su"))
1130 See the documentation for the variable
1131 @code{tramp-default-method-alist} for more details.
1133 External transfer methods are normally preferable to inline transfer
1134 methods, giving better performance.
1136 @xref{Inline methods}.
1137 @xref{External transfer methods}.
1139 Another consideration with the selection of transfer methods is the
1140 environment you will use them in and, especially when used over the
1141 Internet, the security implications of your preferred method.
1143 The @option{rsh} and @option{telnet} methods send your password as
1144 plain text as you log in to the remote machine, as well as
1145 transferring the files in such a way that the content can easily be
1146 read from other machines.
1148 If you need to connect to remote systems that are accessible from the
1149 Internet, you should give serious thought to using @option{ssh} based
1150 methods to connect. These provide a much higher level of security,
1151 making it a non-trivial exercise for someone to obtain your password
1152 or read the content of the files you are editing.
1155 @subsection Which method is the right one for me?
1156 @cindex choosing the right method
1158 Given all of the above, you are probably thinking that this is all fine
1159 and good, but it's not helping you to choose a method! Right you are.
1160 As a developer, we don't want to boss our users around but give them
1161 maximum freedom instead. However, the reality is that some users would
1162 like to have some guidance, so here I'll try to give you this guidance
1163 without bossing you around. You tell me whether it works @dots{}
1165 My suggestion is to use an inline method. For large files, out-of-band
1166 methods might be more efficient, but I guess that most people will want
1167 to edit mostly small files.
1169 I guess that these days, most people can access a remote machine by
1170 using @command{ssh}. So I suggest that you use the @option{ssh}
1171 method. So, type @kbd{C-x C-f @trampfn{ssh, root, otherhost,
1172 /etc/motd} @key{RET}} to edit the @file{/etc/motd} file on the other
1175 If you can't use @option{ssh} to log in to the remote host, then
1176 select a method that uses a program that works. For instance, Windows
1177 users might like the @option{plink} method which uses the PuTTY
1178 implementation of @command{ssh}. Or you use Kerberos and thus like
1181 For the special case of editing files on the local host as another
1182 user, see the @option{su} or @option{sudo} methods. They offer
1183 shortened syntax for the @samp{root} account, like
1184 @file{@trampfn{su, , , /etc/motd}}.
1186 People who edit large files may want to consider @option{scpc} instead
1187 of @option{ssh}, or @option{pscp} instead of @option{plink}. These
1188 out-of-band methods are faster than inline methods for large files.
1189 Note, however, that out-of-band methods suffer from some limitations.
1190 Please try first whether you really get a noticeable speed advantage
1191 from using an out-of-band method! Maybe even for large files, inline
1192 methods are fast enough.
1196 @section Selecting a default user
1197 @cindex default user
1199 The user part of a @value{tramp} file name can be omitted. Usually,
1200 it is replaced by the user name you are logged in. Often, this is not
1201 what you want. A typical use of @value{tramp} might be to edit some
1202 files with root permissions on the local host. This case, you should
1203 set the variable @code{tramp-default-user} to reflect that choice.
1207 (setq tramp-default-user "root")
1210 @code{tramp-default-user} is regarded as obsolete, and will be removed
1213 @vindex tramp-default-user-alist
1214 You can also specify different users for certain method/host
1215 combinations, via the variable @code{tramp-default-user-alist}. For
1216 example, if you always have to use the user @samp{john} in the domain
1217 @samp{somewhere.else}, you can specify the following:
1220 (add-to-list 'tramp-default-user-alist
1221 '("ssh" ".*\\.somewhere\\.else\\'" "john"))
1225 See the documentation for the variable
1226 @code{tramp-default-user-alist} for more details.
1228 One trap to fall in must be known. If @value{tramp} finds a default
1229 user, this user will be passed always to the connection command as
1230 parameter (for example @samp{ssh here.somewhere.else -l john}. If you
1231 have specified another user for your command in its configuration
1232 files, @value{tramp} cannot know it, and the remote access will fail.
1233 If you have specified in the given example in @file{~/.ssh/config} the
1237 Host here.somewhere.else
1242 than you must discard selecting a default user by @value{tramp}. This
1243 will be done by setting it to @code{nil} (or @samp{lily}, likewise):
1246 (add-to-list 'tramp-default-user-alist
1247 '("ssh" "\\`here\\.somewhere\\.else\\'" nil))
1250 The last entry in @code{tramp-default-user-alist} could be your
1251 default user you'll apply predominantly. You shall @emph{append} it
1252 to that list at the end:
1255 (add-to-list 'tramp-default-user-alist '(nil nil "jonas") t)
1260 @section Selecting a default host
1261 @cindex default host
1263 @vindex tramp-default-host
1264 Finally, it is even possible to omit the host name part of a
1265 @value{tramp} file name. This case, the value of the variable
1266 @code{tramp-default-host} is used. Per default, it is initialized
1267 with the host name your local @value{emacsname} is running.
1269 If you, for example, use @value{tramp} mainly to contact the host
1270 @samp{target} as user @samp{john}, you can specify:
1273 (setq tramp-default-user "john"
1274 tramp-default-host "target")
1277 Then the simple file name @samp{@trampfn{ssh, , ,}} will connect you
1278 to John's home directory on target.
1280 Note, however, that the most simplification @samp{/::} won't work,
1281 because @samp{/:} is the prefix for quoted file names.
1286 @section Connecting to a remote host using multiple hops
1290 Sometimes, the methods described before are not sufficient. Sometimes,
1291 it is not possible to connect to a remote host using a simple command.
1292 For example, if you are in a secured network, you might have to log in
1293 to a `bastion host' first before you can connect to the outside world.
1294 Of course, the target host may also require a bastion host.
1296 @vindex tramp-default-proxies-alist
1297 In order to specify such multiple hops, it is possible to define a proxy
1298 host to pass through, via the variable
1299 @code{tramp-default-proxies-alist}. This variable keeps a list of
1300 triples (@var{host} @var{user} @var{proxy}).
1302 The first matching item specifies the proxy host to be passed for a
1303 file name located on a remote target matching @var{user}@@@var{host}.
1304 @var{host} and @var{user} are regular expressions or @code{nil}, which
1305 is interpreted as a regular expression which always matches.
1307 @var{proxy} must be a Tramp filename which localname part is ignored.
1308 Method and user name on @var{proxy} are optional, which is interpreted
1309 with the default values.
1311 The method must be an inline or gateway method (@pxref{Inline
1312 methods}, @pxref{Gateway methods}).
1315 The method must be an inline method (@pxref{Inline methods}).
1317 If @var{proxy} is @code{nil}, no additional hop is required reaching
1318 @var{user}@@@var{host}.
1320 If you, for example, must pass the host @samp{bastion.your.domain} as
1321 user @samp{bird} for any remote host which is not located in your local
1325 (add-to-list 'tramp-default-proxies-alist
1326 '("\\." nil "@trampfn{ssh, bird, bastion.your.domain,}"))
1327 (add-to-list 'tramp-default-proxies-alist
1328 '("\\.your\\.domain\\'" nil nil))
1331 Please note the order of the code. @code{add-to-list} adds elements at the
1332 beginning of a list. Therefore, most relevant rules must be added last.
1334 Proxy hosts can be cascaded. If there is another host called
1335 @samp{jump.your.domain}, which is the only one in your local domain who
1336 is allowed connecting @samp{bastion.your.domain}, you can add another
1340 (add-to-list 'tramp-default-proxies-alist
1341 '("\\`bastion\\.your\\.domain\\'"
1343 "@trampfn{ssh, , jump.your.domain,}"))
1346 @var{proxy} can contain the patterns @code{%h} or @code{%u}. These
1347 patterns are replaced by the strings matching @var{host} or
1348 @var{user}, respectively.
1350 If you, for example, wants to work as @samp{root} on hosts in the
1351 domain @samp{your.domain}, but login as @samp{root} is disabled for
1352 non-local access, you might add the following rule:
1355 (add-to-list 'tramp-default-proxies-alist
1356 '("\\.your\\.domain\\'" "\\`root\\'" "@trampfn{ssh, , %h,}"))
1359 Opening @file{@trampfn{sudo, , randomhost.your.domain,}} would connect
1360 first @samp{randomhost.your.domain} via @code{ssh} under your account
1361 name, and perform @code{sudo -u root} on that host afterwards. It is
1362 important to know that the given method is applied on the host which
1363 has been reached so far. @code{sudo -u root}, applied on your local
1364 host, wouldn't be useful here.
1366 This is the recommended configuration to work as @samp{root} on remote
1370 Finally, @code{tramp-default-proxies-alist} can be used to pass
1371 firewalls or proxy servers. Imagine your local network has a host
1372 @samp{proxy.your.domain} which is used on port 3128 as HTTP proxy to
1373 the outer world. Your friendly administrator has granted you access
1374 under your user name to @samp{host.other.domain} on that proxy
1375 server.@footnote{HTTP tunnels are intended for secure SSL/TLS
1376 communication. Therefore, many proxy server restrict the tunnels to
1377 related target ports. You might need to run your ssh server on your
1378 target host @samp{host.other.domain} on such a port, like 443 (https).
1379 See @uref{http://savannah.gnu.org/maintenance/CvsFromBehindFirewall}
1380 for discussion of ethical issues.} You would need to add the
1384 (add-to-list 'tramp-default-proxies-alist
1385 '("\\`host\\.other\\.domain\\'" nil
1386 "@trampfn{tunnel, , proxy.your.domain#3128,}"))
1389 Gateway methods can be declared as first hop only in a multiple hop
1394 @node Customizing Methods
1395 @section Using Non-Standard Methods
1396 @cindex customizing methods
1397 @cindex using non-standard methods
1398 @cindex create your own methods
1400 There is a variable @code{tramp-methods} which you can change if the
1401 predefined methods don't seem right.
1403 For the time being, I'll refer you to the Lisp documentation of that
1404 variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1407 @node Customizing Completion
1408 @section Selecting config files for user/host name completion
1409 @cindex customizing completion
1410 @cindex selecting config files
1411 @vindex tramp-completion-function-alist
1413 The variable @code{tramp-completion-function-alist} is intended to
1414 customize which files are taken into account for user and host name
1415 completion (@pxref{Filename completion}). For every method, it keeps
1416 a set of configuration files, accompanied by a Lisp function able to
1417 parse that file. Entries in @code{tramp-completion-function-alist}
1418 have the form (@var{method} @var{pair1} @var{pair2} ...).
1420 Each @var{pair} is composed of (@var{function} @var{file}).
1421 @var{function} is responsible to extract user names and host names
1422 from @var{file} for completion. There are two functions which access
1425 @defun tramp-get-completion-function method
1426 This function returns the list of completion functions for @var{method}.
1430 (tramp-get-completion-function "rsh")
1432 @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1433 (tramp-parse-rhosts "~/.rhosts"))
1437 @defun tramp-set-completion-function method function-list
1438 This function sets @var{function-list} as list of completion functions
1443 (tramp-set-completion-function "ssh"
1444 '((tramp-parse-sconfig "/etc/ssh_config")
1445 (tramp-parse-sconfig "~/.ssh/config")))
1447 @result{} ((tramp-parse-sconfig "/etc/ssh_config")
1448 (tramp-parse-sconfig "~/.ssh/config"))
1452 The following predefined functions parsing configuration files exist:
1455 @item @code{tramp-parse-rhosts}
1456 @findex tramp-parse-rhosts
1458 This function parses files which are syntactical equivalent to
1459 @file{~/.rhosts}. It returns both host names and user names, if
1462 @item @code{tramp-parse-shosts}
1463 @findex tramp-parse-shosts
1465 This function parses files which are syntactical equivalent to
1466 @file{~/.ssh/known_hosts}. Since there are no user names specified
1467 in such files, it can return host names only.
1469 @item @code{tramp-parse-sconfig}
1470 @findex tramp-parse-shosts
1472 This function returns the host nicknames defined by @code{Host} entries
1473 in @file{~/.ssh/config} style files.
1475 @item @code{tramp-parse-shostkeys}
1476 @findex tramp-parse-shostkeys
1478 SSH2 parsing of directories @file{/etc/ssh2/hostkeys/*} and
1479 @file{~/ssh2/hostkeys/*}. Hosts are coded in file names
1480 @file{hostkey_@var{portnumber}_@var{host-name}.pub}. User names
1481 are always @code{nil}.
1483 @item @code{tramp-parse-sknownhosts}
1484 @findex tramp-parse-shostkeys
1486 Another SSH2 style parsing of directories like
1487 @file{/etc/ssh2/knownhosts/*} and @file{~/ssh2/knownhosts/*}. This
1488 case, hosts names are coded in file names
1489 @file{@var{host-name}.@var{algorithm}.pub}. User names are always @code{nil}.
1491 @item @code{tramp-parse-hosts}
1492 @findex tramp-parse-hosts
1494 A function dedicated to @file{/etc/hosts} style files. It returns
1497 @item @code{tramp-parse-passwd}
1498 @findex tramp-parse-passwd
1500 A function which parses @file{/etc/passwd} like files. Obviously, it
1501 can return user names only.
1503 @item @code{tramp-parse-netrc}
1504 @findex tramp-parse-netrc
1506 Finally, a function which parses @file{~/.netrc} like files.
1509 If you want to keep your own data in a file, with your own structure,
1510 you might provide such a function as well. This function must meet
1511 the following conventions:
1513 @defun my-tramp-parse file
1514 @var{file} must be either a file name on your host, or @code{nil}.
1515 The function must return a list of (@var{user} @var{host}), which are
1516 taken as candidates for user and host name completion.
1520 (my-tramp-parse "~/.my-tramp-hosts")
1522 @result{} ((nil "toto") ("daniel" "melancholia"))
1527 @node Password caching
1528 @section Reusing passwords for several connections.
1531 Sometimes it is necessary to connect to the same remote host several
1532 times. Reentering passwords again and again would be annoying, when
1533 the chosen method does not support access without password prompt
1534 through own configuration.
1536 By default, @value{tramp} caches the passwords entered by you. They will
1537 be reused next time if a connection needs them for the same user name
1538 and host name, independently of the connection method.
1540 @vindex password-cache-expiry
1541 Passwords are not saved permanently, that means the password caching
1542 is limited to the lifetime of your @value{emacsname} session. You
1543 can influence the lifetime of password caching by customizing the
1544 variable @code{password-cache-expiry}. The value is the number of
1545 seconds how long passwords are cached. Setting it to @code{nil}
1546 disables the expiration.
1548 @vindex password-cache
1549 If you don't like this feature for security reasons, password caching
1550 can be disabled totally by customizing the variable
1551 @code{password-cache} (setting it to @code{nil}).
1553 Implementation Note: password caching is based on the package
1554 @file{password.el} in No Gnus. For the time being, it is activated
1555 only when this package is seen in the @code{load-path} while loading
1557 @ifset installchapter
1558 If you don't use No Gnus, you can take @file{password.el} from the
1559 @value{tramp} @file{contrib} directory, see @ref{Installation
1562 It will be activated mandatory once No Gnus has found its way into
1566 @node Connection caching
1567 @section Reusing connection related information.
1570 @vindex tramp-persistency-file-name
1571 In order to reduce initial connection time, @value{tramp} stores
1572 connection related information persistently. The variable
1573 @code{tramp-persistency-file-name} keeps the file name where these
1574 information are written. Its default value is
1576 @file{~/.emacs.d/tramp}.
1579 @file{~/.xemacs/tramp}.
1581 It is recommended to choose a local file name.
1583 @value{tramp} reads this file during startup, and writes it when
1584 exiting @value{emacsname}. You can simply remove this file if
1585 @value{tramp} shall be urged to recompute these information next
1586 @value{emacsname} startup time.
1588 Using such persistent information can be disabled by setting
1589 @code{tramp-persistency-file-name} to @code{nil}.
1591 Once consequence of reusing connection related information is that
1592 @var{tramp} needs to distinguish hosts. If you, for example, run a
1593 local @code{sshd} on port 3001, which tunnels @command{ssh} to another
1594 host, you could access both @file{@trampfn{ssh, , localhost,}} and
1595 @file{@trampfn{ssh, , localhost#3001,}}. @var{tramp} would use the
1596 same host related information (like paths, Perl variants, etc) for
1597 both connections, although the information is valid only for one of
1600 In order to avoid trouble, you must use another host name for one of
1601 the connections, like introducing a @option{Host} section in
1602 @file{~/.ssh/config} (@pxref{Frequently Asked Questions}) or applying
1603 multiple hops (@pxref{Multi-hops}).
1606 @node Remote Programs
1607 @section How @value{tramp} finds and uses programs on the remote machine.
1609 @value{tramp} depends on a number of programs on the remote host in order to
1610 function, including @command{ls}, @command{test}, @command{find} and
1613 In addition to these required tools, there are various tools that may be
1614 required based on the connection method. See @ref{Inline methods} and
1615 @ref{External transfer methods} for details on these.
1617 Certain other tools, such as @command{perl} (or @command{perl5}) and
1618 @command{grep} will be used if they can be found. When they are
1619 available, they are used to improve the performance and accuracy of
1622 @vindex tramp-remote-path
1623 When @value{tramp} connects to the remote machine, it searches for the
1624 programs that it can use. The variable @code{tramp-remote-path}
1625 controls the directories searched on the remote machine.
1627 By default, this is set to a reasonable set of defaults for most
1628 machines. The symbol @code{tramp-default-remote-path} is a place
1629 holder, it is replaced by the list of directories received via the
1630 command @command{getconf PATH} on your remote machine. For example,
1631 on GNU Debian this is @file{/bin:/usr/bin}, whereas on Solaris this is
1632 @file{/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin}. It is
1633 recommended to apply this symbol on top of @code{tramp-remote-path}.
1635 It is possible, however, that your local (or remote ;) system
1636 administrator has put the tools you want in some obscure local
1639 In this case, you can still use them with @value{tramp}. You simply
1640 need to add code to your @file{.emacs} to add the directory to the
1641 remote path. This will then be searched by @value{tramp} when you
1642 connect and the software found.
1644 To add a directory to the remote search path, you could use code such
1648 @i{;; We load @value{tramp} to define the variable.}
1650 @i{;; We have @command{perl} in "/usr/local/perl/bin"}
1651 (add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1654 @value{tramp} caches several information, like the Perl binary
1655 location. The changed remote search path wouldn't affect these
1656 settings. In order to force @value{tramp} to recompute these values,
1657 you must exit @value{emacsname}, remove your persistency file
1658 (@pxref{Connection caching}), and restart @value{emacsname}.
1661 @node Remote shell setup
1662 @section Remote shell setup hints
1663 @cindex remote shell setup
1664 @cindex @file{.profile} file
1665 @cindex @file{.login} file
1666 @cindex shell init files
1668 As explained in the @ref{Overview} section, @value{tramp} connects to the
1669 remote host and talks to the shell it finds there. Of course, when you
1670 log in, the shell executes its init files. Suppose your init file
1671 requires you to enter the birth date of your mother; clearly @value{tramp}
1672 does not know this and hence fails to log you in to that host.
1674 There are different possible strategies for pursuing this problem. One
1675 strategy is to enable @value{tramp} to deal with all possible situations.
1676 This is a losing battle, since it is not possible to deal with
1677 @emph{all} situations. The other strategy is to require you to set up
1678 the remote host such that it behaves like @value{tramp} expects. This might
1679 be inconvenient because you have to invest a lot of effort into shell
1680 setup before you can begin to use @value{tramp}.
1682 The package, therefore, pursues a combined approach. It tries to
1683 figure out some of the more common setups, and only requires you to
1684 avoid really exotic stuff. For example, it looks through a list of
1685 directories to find some programs on the remote host. And also, it
1686 knows that it is not obvious how to check whether a file exists, and
1687 therefore it tries different possibilities. (On some hosts and
1688 shells, the command @command{test -e} does the trick, on some hosts
1689 the shell builtin doesn't work but the program @command{/usr/bin/test
1690 -e} or @command{/bin/test -e} works. And on still other hosts,
1691 @command{ls -d} is the right way to do this.)
1693 Below you find a discussion of a few things that @value{tramp} does not deal
1694 with, and that you therefore have to set up correctly.
1697 @item @var{shell-prompt-pattern}
1698 @vindex shell-prompt-pattern
1700 After logging in to the remote host, @value{tramp} has to wait for the remote
1701 shell startup to finish before it can send commands to the remote
1702 shell. The strategy here is to wait for the shell prompt. In order to
1703 recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1704 to be set correctly to recognize the shell prompt on the remote host.
1706 Note that @value{tramp} requires the match for @code{shell-prompt-pattern}
1707 to be at the end of the buffer. Many people have something like the
1708 following as the value for the variable: @code{"^[^>$][>$] *"}. Now
1709 suppose your shell prompt is @code{a <b> c $ }. In this case,
1710 @value{tramp} recognizes the @code{>} character as the end of the prompt,
1711 but it is not at the end of the buffer.
1713 @item @var{tramp-shell-prompt-pattern}
1714 @vindex tramp-shell-prompt-pattern
1716 This regular expression is used by @value{tramp} in the same way as
1717 @code{shell-prompt-pattern}, to match prompts from the remote shell.
1718 This second variable exists because the prompt from the remote shell
1719 might be different from the prompt from a local shell --- after all,
1720 the whole point of @value{tramp} is to log in to remote hosts as a
1721 different user. The default value of
1722 @code{tramp-shell-prompt-pattern} is the same as the default value of
1723 @code{shell-prompt-pattern}, which is reported to work well in many
1726 @item @var{tramp-password-prompt-regexp}
1727 @vindex tramp-password-prompt-regexp
1728 @vindex tramp-wrong-passwd-regexp
1730 During login, @value{tramp} might be forced to enter a password or a
1731 passphrase. The difference between both is that a password is
1732 requested from the shell on the remote host, while a passphrase is
1733 needed for accessing local authentication information, like your ssh
1736 @var{tramp-password-prompt-regexp} handles the detection of such
1737 requests for English environments. When you use another localization
1738 of your (local or remote) host, you might need to adapt this. Example:
1742 tramp-password-prompt-regexp
1746 '("passphrase" "Passphrase"
1748 "password" "Password"
1750 "passwort" "Passwort"
1752 "mot de passe" "Mot de passe") t)