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,
42 2006, 2007, 2008 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 Manual'',
49 and with the Back-Cover Texts as in (a) below. A copy of the license
50 is included in the section entitled ``GNU Free Documentation License''.
52 (a) The FSF's Back-Cover Text is: ``You have the freedom to
53 copy and modify this GNU manual. Buying copies from the FSF
54 supports it in developing GNU and promoting software freedom.''
58 @c Entries for @command{install-info} to use
59 @dircategory @value{emacsname}
61 * TRAMP: (tramp). Transparent Remote Access, Multiple Protocol
62 @value{emacsname} remote file access via rsh and rcp.
68 @title @value{tramp} version @value{trampver} User Manual
70 @author by Daniel Pittman
71 @author based on documentation by Kai Gro@ss{}johann
82 @node Top, Overview, (dir), (dir)
83 @top @value{tramp} version @value{trampver} User Manual
85 This file documents @value{tramp} version @value{trampver}, a remote file
86 editing package for @value{emacsname}.
88 @value{tramp} stands for `Transparent Remote (file) Access, Multiple
89 Protocol'. This package provides remote file editing, similar to
90 @value{ftppackagename}.
92 The difference is that @value{ftppackagename} uses FTP to transfer
93 files between the local and the remote host, whereas @value{tramp} uses a
94 combination of @command{rsh} and @command{rcp} or other work-alike
95 programs, such as @command{ssh}/@command{scp}.
97 You can find the latest version of this document on the web at
98 @uref{http://www.gnu.org/software/tramp/}.
100 @c Pointer to the other Emacs flavor is necessary only in case of
101 @c standalone installation.
102 @ifset installchapter
103 The manual has been generated for @value{emacsname}.
105 If you want to read the info pages for @value{emacsothername}, you
106 should read in @ref{Installation} how to create them.
109 If you're using the other Emacs flavor, you should read the
110 @uref{@value{emacsotherfilename}, @value{emacsothername}} pages.
116 This manual is also available as a @uref{@value{japanesemanual},
117 Japanese translation}.
120 The latest release of @value{tramp} is available for
121 @uref{ftp://ftp.gnu.org/gnu/tramp/, download}, or you may see
122 @ref{Obtaining Tramp} for more details, including the CVS server
125 @value{tramp} also has a @uref{http://savannah.gnu.org/projects/tramp/,
126 Savannah Project Page}.
129 There is a mailing list for @value{tramp}, available at
130 @email{tramp-devel@@gnu.org}, and archived at
131 @uref{http://lists.gnu.org/archive/html/tramp-devel/, the
132 @value{tramp} Mail Archive}.
134 Older archives are located at
135 @uref{http://sourceforge.net/mailarchive/forum.php?forum=tramp-devel,
136 SourceForge Mail Archive} and
137 @uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/,
139 @c in HTML output, there's no new paragraph.
148 * Overview:: What @value{tramp} can and cannot do.
152 * Obtaining Tramp:: How to obtain @value{tramp}.
153 * History:: History of @value{tramp}.
154 @ifset installchapter
155 * Installation:: Installing @value{tramp} with your @value{emacsname}.
157 * Configuration:: Configuring @value{tramp} for use.
158 * Usage:: An overview of the operation of @value{tramp}.
159 * Bug Reports:: Reporting Bugs and Problems.
160 * Frequently Asked Questions:: Questions and answers from the mailing list.
161 * Function Index:: @value{tramp} functions.
162 * Variable Index:: User options and variables.
163 * Concept Index:: An item for each concept.
167 * Version Control:: The inner workings of remote version control.
168 * Files directories and localnames:: How file names, directories and localnames are mangled and managed.
169 * Traces and Profiles:: How to Customize Traces.
170 * Issues:: Debatable Issues and What Was Decided.
172 * GNU Free Documentation License:: The license for this documentation.
175 --- The Detailed Node Listing ---
177 @ifset installchapter
178 Installing @value{tramp} with your @value{emacsname}
180 * Installation parameters:: Parameters in order to control installation.
181 * Load paths:: How to plug-in @value{tramp} into your environment.
182 * Japanese manual:: Japanese manual.
186 Configuring @value{tramp} for use
188 * Connection types:: Types of connections made to remote machines.
189 * Inline methods:: Inline methods.
190 * External transfer methods:: External transfer methods.
192 * Gateway methods:: Gateway methods.
194 * Default Method:: Selecting a default method.
195 * Default User:: Selecting a default user.
196 * Default Host:: Selecting a default host.
197 * Multi-hops:: Connecting to a remote host using multiple hops.
198 * Customizing Methods:: Using Non-Standard Methods.
199 * Customizing Completion:: Selecting config files for user/host name completion.
200 * Password caching:: Reusing passwords for several connections.
201 * Connection caching:: Reusing connection related information.
202 * Remote Programs:: How @value{tramp} finds and uses programs on the remote machine.
203 * Remote shell setup:: Remote shell setup hints.
204 * Windows setup hints:: Issues with Cygwin ssh.
205 * Auto-save and Backup:: Auto-save and Backup.
209 * Filename Syntax:: @value{tramp} filename conventions.
210 * Alternative Syntax:: URL-like filename syntax.
211 * Filename completion:: Filename completion.
212 * Remote processes:: Integration with other @value{emacsname} packages.
213 * Cleanup remote connections:: Cleanup remote connections.
215 The inner workings of remote version control
217 * Version Controlled Files:: Determining if a file is under version control.
218 * Remote Commands:: Executing the version control commands on the remote machine.
219 * Changed workfiles:: Detecting if the working file has changed.
220 * Checking out files:: Bringing the workfile out of the repository.
221 * Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
223 Things related to Version Control that don't fit elsewhere
225 * Remote File Ownership:: How VC determines who owns a workfile.
226 * Back-end Versions:: How VC determines what release your RCS is.
228 How file names, directories and localnames are mangled and managed
230 * Localname deconstruction:: Breaking a localname into its components.
232 * External packages:: Integration with external Lisp packages.
239 @chapter An overview of @value{tramp}
242 After the installation of @value{tramp} into your @value{emacsname}, you
243 will be able to access files on remote machines as though they were
244 local. Access to the remote file system for editing files, version
245 control, and @code{dired} are transparently enabled.
247 Your access to the remote machine can be with the @command{rsh},
248 @command{rlogin}, @command{telnet} programs or with any similar
249 connection method. This connection must pass @acronym{ASCII}
250 successfully to be usable but need not be 8-bit clean.
252 The package provides support for @command{ssh} connections out of the
253 box, one of the more common uses of the package. This allows
254 relatively secure access to machines, especially if @command{ftp}
257 Under Windows, @value{tramp} is integrated with the PuTTY package,
258 using the @command{plink} program.
260 The majority of activity carried out by @value{tramp} requires only that
261 the remote login is possible and is carried out at the terminal. In
262 order to access remote files @value{tramp} needs to transfer their content
263 to the local machine temporarily.
265 @value{tramp} can transfer files between the machines in a variety of ways.
266 The details are easy to select, depending on your needs and the
267 machines in question.
269 The fastest transfer methods for large files rely on a remote file
270 transfer package such as @command{rcp}, @command{scp}, @command{rsync}
271 or (under Windows) @command{pscp}.
273 If the remote copy methods are not suitable for you, @value{tramp} also
274 supports the use of encoded transfers directly through the shell.
275 This requires that the @command{mimencode} or @command{uuencode} tools
276 are available on the remote machine. These methods are generally
277 faster for small files.
279 @value{tramp} is still under active development and any problems you encounter,
280 trivial or major, should be reported to the @value{tramp} developers.
284 @subsubheading Behind the scenes
285 @cindex behind the scenes
286 @cindex details of operation
289 This section tries to explain what goes on behind the scenes when you
290 access a remote file through @value{tramp}.
292 Suppose you type @kbd{C-x C-f} and enter part of an @value{tramp} file name,
293 then hit @kbd{@key{TAB}} for completion. Suppose further that this is
294 the first time that @value{tramp} is invoked for the host in question. Here's
299 @value{tramp} discovers that it needs a connection to the host. So it
300 invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
301 @var{user}} or a similar tool to connect to the remote host.
302 Communication with this process happens through an
303 @value{emacsname} buffer, that is, the output from the remote end
307 The remote host may prompt for a login name (for @command{telnet}).
308 The login name is given in the file name, so @value{tramp} sends the
309 login name and a newline.
312 The remote host may prompt for a password or pass phrase (for
313 @command{rsh} or for @command{telnet} after sending the login name).
314 @value{tramp} displays the prompt in the minibuffer, asking you for the
315 password or pass phrase.
317 You enter the password or pass phrase. @value{tramp} sends it to the remote
318 host, followed by a newline.
321 @value{tramp} now waits for the shell prompt or for a message that the login
324 If @value{tramp} sees neither of them after a certain period of time
325 (a minute, say), then it issues an error message saying that it
326 couldn't find the remote shell prompt and shows you what the remote
329 If @value{tramp} sees a @samp{login failed} message, it tells you so,
330 aborts the login attempt and allows you to try again.
333 Suppose that the login was successful and @value{tramp} sees the shell prompt
334 from the remote host. Now @value{tramp} invokes @command{/bin/sh} because
335 Bourne shells and C shells have different command
336 syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
337 shell doesn't recognize @samp{exec /bin/sh} as a valid command.
338 Maybe you use the Scheme shell @command{scsh}@dots{}}
340 After the Bourne shell has come up, @value{tramp} sends a few commands to
341 ensure a good working environment. It turns off echoing, it sets the
342 shell prompt, and a few other things.
345 Now the remote shell is up and it good working order. Remember, what
346 was supposed to happen is that @value{tramp} tries to find out what files exist
347 on the remote host so that it can do filename completion.
349 So, @value{tramp} basically issues @command{cd} and @command{ls} commands and
350 also sometimes @command{echo} with globbing. Another command that is
351 often used is @command{test} to find out whether a file is writable or a
352 directory or the like. The output of each command is parsed for the
356 Suppose you are finished with filename completion, have entered @kbd{C-x
357 C-f}, a full file name and hit @kbd{@key{RET}}. Now comes the time to
358 transfer the file contents from the remote host to the local host so
359 that you can edit them.
361 See above for an explanation of how @value{tramp} transfers the file contents.
363 For inline transfers, @value{tramp} issues a command like @samp{mimencode -b
364 /path/to/remote/file}, waits until the output has accumulated in the
365 buffer that's used for communication, then decodes that output to
366 produce the file contents.
368 For out-of-band transfers, @value{tramp} issues a command like the following:
370 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
372 It then reads the local temporary file @file{/tmp/tramp.4711} into a
373 buffer and deletes the temporary file.
376 You now edit the buffer contents, blithely unaware of what has happened
377 behind the scenes. (Unless you have read this section, that is.) When
378 you are finished, you type @kbd{C-x C-s} to save the buffer.
381 Again, @value{tramp} transfers the file contents to the remote host either
382 inline or out-of-band. This is the reverse of what happens when reading
386 I hope this has provided you with a basic overview of what happens
387 behind the scenes when you open a file with @value{tramp}.
391 @node Obtaining Tramp
392 @chapter Obtaining Tramp.
393 @cindex obtaining Tramp
395 @value{tramp} is freely available on the Internet and the latest
396 release may be downloaded from
397 @uref{ftp://ftp.gnu.org/gnu/tramp/}. This release includes the full
398 documentation and code for @value{tramp}, suitable for installation.
399 But GNU Emacs (22 or later) includes @value{tramp} already, and there
400 is a @value{tramp} package for XEmacs, as well. So maybe it is easier
401 to just use those. But if you want the bleeding edge, read
404 For the especially brave, @value{tramp} is available from CVS. The CVS
405 version is the latest version of the code and may contain incomplete
406 features or new issues. Use these versions at your own risk.
408 Instructions for obtaining the latest development version of @value{tramp}
409 from CVS can be found by going to the Savannah project page at the
410 following URL and then clicking on the CVS link in the navigation bar
414 @uref{http://savannah.gnu.org/projects/tramp/}
417 Or follow the example session below:
420 ] @strong{cd ~/@value{emacsdir}}
421 ] @strong{export CVS_RSH="ssh"}
422 ] @strong{cvs -z3 -d:ext:anoncvs@@savannah.gnu.org:/cvsroot/tramp co tramp}
426 You should now have a directory @file{~/@value{emacsdir}/tramp}
427 containing the latest version of @value{tramp}. You can fetch the latest
428 updates from the repository by issuing the command:
431 ] @strong{cd ~/@value{emacsdir}/tramp}
432 ] @strong{export CVS_RSH="ssh"}
433 ] @strong{cvs update -d}
437 Once you've got updated files from the CVS repository, you need to run
438 @command{autoconf} in order to get an up-to-date @file{configure}
442 ] @strong{cd ~/@value{emacsdir}/tramp}
446 People who have no direct CVS access (maybe because sitting behind a
447 blocking firewall), can try the
448 @uref{http://savannah.gnu.org/cvs-backup/tramp-sources.tar.gz, Nightly
449 CVS Tree Tarball} instead of.
453 @chapter History of @value{tramp}
455 @cindex development history
457 Development was started end of November 1998. The package was called
458 @file{rssh.el}, back then. It only provided one method to access a
459 file, using @command{ssh} to log in to a remote host and using
460 @command{scp} to transfer the file contents. After a while, the name
461 was changed to @file{rcp.el}, and now it's @value{tramp}. Along the way,
462 many more methods for getting a remote shell and for transferring the
463 file contents were added. Support for VC was added.
465 The most recent addition of major features were the multi-hop methods
466 added in April 2000 and the unification of @value{tramp} and Ange-FTP
467 filenames in July 2002. In July 2004, multi-hop methods have been
468 replaced by proxy hosts. Running commands on remote hosts was
469 introduced in December 2005.
471 Support of gateways exists since April 2007.
474 In December 2001, @value{tramp} has been added to the XEmacs package
475 repository. Being part of the GNU Emacs repository happened in June
476 2002, the first release including @value{tramp} was GNU Emacs 22.1.
478 @value{tramp} is also a GNU/Linux Debian package since February 2001.
481 @c Installation chapter is necessary only in case of standalone
482 @c installation. Text taken from trampinst.texi.
483 @ifset installchapter
484 @include trampinst.texi
488 @chapter Configuring @value{tramp} for use
489 @cindex configuration
491 @cindex default configuration
492 @value{tramp} is (normally) fully functional when it is initially
493 installed. It is initially configured to use the @command{scp}
494 program to connect to the remote host. So in the easiest case, you
495 just type @kbd{C-x C-f} and then enter the filename
496 @file{@trampfn{, user, machine, /path/to.file}}.
498 On some hosts, there are problems with opening a connection. These are
499 related to the behavior of the remote shell. See @xref{Remote shell
500 setup}, for details on this.
502 If you do not wish to use these commands to connect to the remote
503 host, you should change the default connection and transfer method
504 that @value{tramp} uses. There are several different methods that @value{tramp}
505 can use to connect to remote machines and transfer files
506 (@pxref{Connection types}).
508 If you don't know which method is right for you, see @xref{Default
513 * Connection types:: Types of connections made to remote machines.
514 * Inline methods:: Inline methods.
515 * External transfer methods:: External transfer methods.
517 * Gateway methods:: Gateway methods.
519 * Default Method:: Selecting a default method.
520 Here we also try to help those who
521 don't have the foggiest which method
523 * Default User:: Selecting a default user.
524 * Default Host:: Selecting a default host.
525 * Multi-hops:: Connecting to a remote host using multiple hops.
526 * Customizing Methods:: Using Non-Standard Methods.
527 * Customizing Completion:: Selecting config files for user/host name completion.
528 * Password caching:: Reusing passwords for several connections.
529 * Connection caching:: Reusing connection related information.
530 * Remote Programs:: How @value{tramp} finds and uses programs on the remote machine.
531 * Remote shell setup:: Remote shell setup hints.
532 * Windows setup hints:: Issues with Cygwin ssh.
533 * Auto-save and Backup:: Auto-save and Backup.
537 @node Connection types
538 @section Types of connections made to remote machines.
539 @cindex connection types, overview
541 There are two basic types of transfer methods, each with its own
542 advantages and limitations. Both types of connection make use of a
543 remote shell access program such as @command{rsh}, @command{ssh} or
544 @command{telnet} to connect to the remote machine.
546 This connection is used to perform many of the operations that @value{tramp}
547 requires to make the remote file system transparently accessible from
548 the local machine. It is only when visiting files that the methods
551 @cindex inline methods
552 @cindex external transfer methods
553 @cindex external methods
554 @cindex out-of-band methods
555 @cindex methods, inline
556 @cindex methods, external transfer
557 @cindex methods, out-of-band
558 Loading or saving a remote file requires that the content of the file
559 be transfered between the two machines. The content of the file can be
560 transfered over the same connection used to log in to the remote
561 machine or the file can be transfered through another connection using
562 a remote copy program such as @command{rcp}, @command{scp} or
563 @command{rsync}. The former are called @dfn{inline methods}, the
564 latter are called @dfn{out-of-band methods} or @dfn{external transfer
565 methods} (@dfn{external methods} for short).
567 The performance of the external transfer methods is generally better
568 than that of the inline methods, at least for large files. This is
569 caused by the need to encode and decode the data when transferring
572 The one exception to this rule are the @command{scp} based transfer
573 methods. While these methods do see better performance when actually
574 transferring files, the overhead of the cryptographic negotiation at
575 startup may drown out the improvement in file transfer times.
577 External transfer methods should be configured such a way that they
578 don't require a password (with @command{ssh-agent}, or such alike).
579 Modern @command{scp} implementations offer options to reuse existing
580 @command{ssh} connections, see method @command{scpc}. If it isn't
581 possible, you should consider @ref{Password caching}, otherwise you
582 will be prompted for a password every copy action.
586 @section Inline methods
587 @cindex inline methods
588 @cindex methods, inline
590 The inline methods in @value{tramp} are quite powerful and can work in
591 situations where you cannot use an external transfer program to connect.
592 Inline methods are the only methods that work when connecting to the
593 remote machine via telnet. (There are also strange inline methods which
594 allow you to transfer files between @emph{user identities} rather than
597 These methods depend on the existence of a suitable encoding and
598 decoding command on remote machine. Locally, @value{tramp} may be able to
599 use features of @value{emacsname} to decode and encode the files or
600 it may require access to external commands to perform that task.
604 @cindex base-64 encoding
605 @value{tramp} checks the availability and usability of commands like
606 @command{mimencode} (part of the @command{metamail} package) or
607 @command{uuencode} on the remote host. The first reliable command
608 will be used. The search path can be customized, see @ref{Remote
611 If both commands aren't available on the remote host, @value{tramp}
612 transfers a small piece of Perl code to the remote host, and tries to
613 apply it for encoding and decoding.
621 Connect to the remote host with @command{rsh}. Due to the unsecure
622 connection it is recommended for very local host topology only.
624 On operating systems which provide the command @command{remsh} instead
625 of @command{rsh}, you can use the method @option{remsh}. This is true
626 for HP-UX or Cray UNICOS, for example.
633 Connect to the remote host with @command{ssh}. This is identical to
634 the previous option except that the @command{ssh} package is used,
635 making the connection more secure.
637 There are also two variants, @option{ssh1} and @option{ssh2}, that
638 call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
639 explicitly select whether you want to use the SSH protocol version 1
640 or 2 to connect to the remote host. (You can also specify in
641 @file{~/.ssh/config}, the SSH configuration file, which protocol
642 should be used, and use the regular @option{ssh} method.)
644 Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
645 @command{ssh1} and @command{ssh2} commands explicitly. If you don't
646 know what these are, you do not need these options.
648 All the methods based on @command{ssh} have an additional kludgy
649 feature: you can specify a host name which looks like @file{host#42}
650 (the real host name, then a hash sign, then a port number). This
651 means to connect to the given host but to also pass @code{-p 42} as
652 arguments to the @command{ssh} command.
655 @item @option{telnet}
656 @cindex method telnet
657 @cindex telnet method
659 Connect to the remote host with @command{telnet}. This is as unsecure
660 as the @option{rsh} method.
667 This method does not connect to a remote host at all, rather it uses
668 the @command{su} program to allow you to edit files as another user.
669 That means, the specified host name in the file name must be either
670 @samp{localhost} or the host name as returned by the function
671 @command{(system-name)}. For an exception of this rule see
679 This is similar to the @option{su} method, but it uses @command{sudo}
680 rather than @command{su} to become a different user.
682 Note that @command{sudo} must be configured to allow you to start a
683 shell as the user. It would be nice if it was sufficient if
684 @command{ls} and @command{mimencode} were allowed, but that is not
685 easy to implement, so I haven't got around to it, yet.
692 As you would expect, this is similar to @option{ssh}, only a little
693 different. Whereas @option{ssh} opens a normal interactive shell on
694 the remote host, this option uses @samp{ssh -t -t @var{host} -l
695 @var{user} /bin/sh} to open a connection. This is useful for users
696 where the normal login shell is set up to ask them a number of
697 questions when logging in. This procedure avoids these questions, and
698 just gives @value{tramp} a more-or-less `standard' login shell to work
701 Note that this procedure does not eliminate questions asked by
702 @command{ssh} itself. For example, @command{ssh} might ask ``Are you
703 sure you want to continue connecting?'' if the host key of the remote
704 host is not known. @value{tramp} does not know how to deal with such a
705 question (yet), therefore you will need to make sure that you can log
706 in without such questions.
708 This is also useful for Windows users where @command{ssh}, when
709 invoked from an @value{emacsname} buffer, tells them that it is not
710 allocating a pseudo tty. When this happens, the login shell is wont
711 to not print any shell prompt, which confuses @value{tramp} mightily.
712 For reasons unknown, some Windows ports for @command{ssh} require the
713 doubled @samp{-t} option.
715 This supports the @samp{-p} kludge.
718 @item @option{krlogin}
719 @cindex method krlogin
720 @cindex krlogin method
721 @cindex Kerberos (with krlogin method)
723 This method is also similar to @option{ssh}. It only uses the
724 @command{krlogin -x} command to log in to the remote host.
731 This method is mostly interesting for Windows users using the PuTTY
732 implementation of SSH. It uses @samp{plink -ssh} to log in to the
735 This supports the @samp{-P} kludge.
737 Additionally, the methods @option{plink1} and @option{plink2} are
738 provided, which call @samp{plink -1 -ssh} or @samp{plink -2 -ssh} in
739 order to use SSH protocol version 1 or 2 explicitly.
741 CCC: Do we have to connect to the remote host once from the command
742 line to accept the SSH key? Maybe this can be made automatic?
744 CCC: Say something about the first shell command failing. This might
745 be due to a wrong setting of @code{tramp-rsh-end-of-line}.
748 @item @option{plinkx}
749 @cindex method plinkx
750 @cindex plinkx method
752 Another method using PuTTY on Windows. Instead of host names, it
753 expects PuTTY session names, calling @samp{plink -load @var{session}
754 -t"}. User names are relevant only in case the corresponding session
755 hasn't defined a user name. Different port numbers must be defined in
763 This is an experimental implementation of the fish protocol, known from
764 the GNU Midnight Commander or the KDE Konqueror. @value{tramp} expects
765 the fish server implementation from the KDE kioslave. That means, the
766 file @file{~/.fishsrv.pl} is expected to reside on the remote host.
768 The implementation lacks good performance. The code is offered anyway,
769 maybe somebody can improve the performance.
774 @node External transfer methods
775 @section External transfer methods
776 @cindex methods, external transfer
777 @cindex methods, out-of-band
778 @cindex external transfer methods
779 @cindex out-of-band methods
781 The external transfer methods operate through multiple channels, using
782 the remote shell connection for many actions while delegating file
783 transfers to an external transfer utility.
785 This saves the overhead of encoding and decoding that multiplexing the
786 transfer through the one connection has with the inline methods.
788 Since external transfer methods need their own overhead opening a new
789 channel, all files which are smaller than @var{tramp-copy-size-limit}
790 are still transferred with the corresponding inline method. It should
791 provide a fair trade-off between both approaches.
794 @item @option{rcp} --- @command{rsh} and @command{rcp}
797 @cindex rcp (with rcp method)
798 @cindex rsh (with rcp method)
800 This method uses the @command{rsh} and @command{rcp} commands to connect
801 to the remote machine and transfer files. This is probably the fastest
802 connection method available.
804 The alternative method @option{remcp} uses the @command{remsh} and
805 @command{rcp} commands. It should be applied on machines where
806 @command{remsh} is used instead of @command{rsh}.
809 @item @option{scp} --- @command{ssh} and @command{scp}
812 @cindex scp (with scp method)
813 @cindex ssh (with scp method)
815 Using @command{ssh} to connect to the remote host and @command{scp} to
816 transfer files between the machines is the best method for securely
817 connecting to a remote machine and accessing files.
819 The performance of this option is also quite good. It may be slower than
820 the inline methods when you often open and close small files however.
821 The cost of the cryptographic handshake at the start of an @command{scp}
822 session can begin to absorb the advantage that the lack of encoding and
825 There are also two variants, @option{scp1} and @option{scp2}, that
826 call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
827 explicitly select whether you want to use the SSH protocol version 1
828 or 2 to connect to the remote host. (You can also specify in
829 @file{~/.ssh/config}, the SSH configuration file, which protocol
830 should be used, and use the regular @option{scp} method.)
832 Two other variants, @option{scp1_old} and @option{scp2_old}, use the
833 @command{ssh1} and @command{ssh2} commands explicitly. If you don't
834 know what these are, you do not need these options.
836 All the @command{ssh} based methods support the kludgy @samp{-p}
837 feature where you can specify a port number to connect to in the host
838 name. For example, the host name @file{host#42} tells @value{tramp} to
839 specify @samp{-p 42} in the argument list for @command{ssh}, and to
840 specify @samp{-P 42} in the argument list for @command{scp}.
843 @item @option{sftp} --- @command{ssh} and @command{sftp}
846 @cindex sftp (with sftp method)
847 @cindex ssh (with sftp method)
849 That is mostly the same method as @option{scp}, but using
850 @command{sftp} as transfer command. So the same remarks are valid.
852 This command does not work like @value{ftppackagename}, where
853 @command{ftp} is called interactively, and all commands are send from
854 within this session. Instead of, @command{ssh} is used for login.
856 This method supports the @samp{-p} hack.
859 @item @option{rsync} --- @command{ssh} and @command{rsync}
862 @cindex rsync (with rsync method)
863 @cindex ssh (with rsync method)
865 Using the @command{ssh} command to connect securely to the remote
866 machine and the @command{rsync} command to transfer files is almost
867 identical to the @option{scp} method.
869 While @command{rsync} performs much better than @command{scp} when
870 transferring files that exist on both hosts, this advantage is lost if
871 the file exists only on one side of the connection.
873 The @command{rsync} based method may be considerably faster than the
874 @command{rcp} based methods when writing to the remote system. Reading
875 files to the local machine is no faster than with a direct copy.
877 This method supports the @samp{-p} hack.
880 @item @option{scpx} --- @command{ssh} and @command{scp}
883 @cindex scp (with scpx method)
884 @cindex ssh (with scpx method)
886 As you would expect, this is similar to @option{scp}, only a little
887 different. Whereas @option{scp} opens a normal interactive shell on
888 the remote host, this option uses @samp{ssh -t -t @var{host} -l
889 @var{user} /bin/sh} to open a connection. This is useful for users
890 where the normal login shell is set up to ask them a number of
891 questions when logging in. This procedure avoids these questions, and
892 just gives @value{tramp} a more-or-less `standard' login shell to work
895 This is also useful for Windows users where @command{ssh}, when
896 invoked from an @value{emacsname} buffer, tells them that it is not
897 allocating a pseudo tty. When this happens, the login shell is wont
898 to not print any shell prompt, which confuses @value{tramp} mightily.
900 This method supports the @samp{-p} hack.
903 @item @option{scpc} --- @command{ssh} and @command{scp}
906 @cindex scp (with scpx method)
907 @cindex ssh (with scpx method)
909 Newer versions of @option{ssh} (for example OpenSSH 4) offer an option
910 @option{ControlMaster}. This allows @option{scp} to reuse an existing
911 @option{ssh} channel, which increases performance.
913 Before you use this method, you shall check whether your @option{ssh}
914 implementation does support this option. Try from the command line
917 ssh localhost -o ControlMaster=yes
920 This method supports the @samp{-p} hack.
923 @item @option{pscp} --- @command{plink} and @command{pscp}
926 @cindex pscp (with pscp method)
927 @cindex plink (with pscp method)
928 @cindex PuTTY (with pscp method)
930 This method is similar to @option{scp}, but it uses the
931 @command{plink} command to connect to the remote host, and it uses
932 @command{pscp} for transferring the files. These programs are part
933 of PuTTY, an SSH implementation for Windows.
935 This method supports the @samp{-P} hack.
938 @item @option{psftp} --- @command{plink} and @command{psftp}
941 @cindex psftp (with psftp method)
942 @cindex plink (with psftp method)
943 @cindex PuTTY (with psftp method)
945 As you would expect, this method is similar to @option{sftp}, but it
946 uses the @command{plink} command to connect to the remote host, and it
947 uses @command{psftp} for transferring the files. These programs are
948 part of PuTTY, an SSH implementation for Windows.
950 This method supports the @samp{-P} hack.
953 @item @option{fcp} --- @command{fsh} and @command{fcp}
956 @cindex fsh (with fcp method)
957 @cindex fcp (with fcp method)
959 This method is similar to @option{scp}, but it uses the @command{fsh}
960 command to connect to the remote host, and it uses @command{fcp} for
961 transferring the files. @command{fsh/fcp} are a front-end for
962 @command{ssh} which allow for reusing the same @command{ssh} session
963 for submitting several commands. This avoids the startup overhead of
964 @command{scp} (which has to establish a secure connection whenever it
965 is called). Note, however, that you can also use one of the inline
966 methods to achieve a similar effect.
968 This method uses the command @samp{fsh @var{host} -l @var{user}
969 /bin/sh -i} to establish the connection, it does not work to just say
970 @command{fsh @var{host} -l @var{user}}.
975 There is no inline method using @command{fsh} as the multiplexing
976 provided by the program is not very useful in our context. @value{tramp}
977 opens just one connection to the remote host and then keeps it open,
985 This is not a native @value{tramp} method. Instead of, it forwards all
986 requests to @value{ftppackagename}.
988 This works only for unified filenames, see @ref{Issues}.
992 @item @option{smb} --- @command{smbclient}
996 This is another not natural @value{tramp} method. It uses the
997 @command{smbclient} command on different Unices in order to connect to
998 an SMB server. An SMB server might be a Samba (or CIFS) server on
999 another UNIX host or, more interesting, a host running MS Windows. So
1000 far, it is tested towards MS Windows NT, MS Windows 2000, and MS
1003 The first directory in the localname must be a share name on the remote
1004 host. Remember, that the @code{$} character in which default shares
1005 usually end, must be written @code{$$} due to environment variable
1006 substitution in file names. If no share name is given (i.e. remote
1007 directory @code{/}), all available shares are listed.
1009 Since authorization is done on share level, you will be prompted
1010 always for a password if you access another share on the same host.
1011 This can be suppressed by @ref{Password caching}.
1013 MS Windows uses for authorization both a user name and a domain name.
1014 Because of this, the @value{tramp} syntax has been extended: you can
1015 specify a user name which looks like @code{user%domain} (the real user
1016 name, then a percent sign, then the domain name). So, to connect to
1017 the machine @code{melancholia} as user @code{daniel} of the domain
1018 @code{BIZARRE}, and edit @file{.emacs} in the home directory (share
1019 @code{daniel$}) I would specify the filename @file{@trampfn{smb,
1020 daniel%BIZARRE, melancholia, /daniel$$/.emacs}}.
1022 Depending on the Windows domain configuration, a Windows user might be
1023 considered as domain user per default. In order to connect as local
1024 user, the WINS name of that machine must be given as domain name.
1025 Usually, it is the machine name in capital letters. In the example
1026 above, the local user @code{daniel} would be specified as
1027 @file{@trampfn{smb, daniel%MELANCHOLIA, melancholia, /daniel$$/.emacs}}.
1029 The domain name as well as the user name are optional. If no user
1030 name is specified at all, the anonymous user (without password
1031 prompting) is assumed. This is different from all other @value{tramp}
1032 methods, where in such a case the local user name is taken.
1034 The @option{smb} method supports the @samp{-p} hack.
1036 @strong{Please note:} If @value{emacsname} runs locally under MS
1037 Windows, this method isn't available. Instead of, you can use UNC
1038 file names like @file{//melancholia/daniel$$/.emacs}. The only
1039 disadvantage is that there's no possibility to specify another user
1046 @node Gateway methods
1047 @section Gateway methods
1048 @cindex methods, gateway
1049 @cindex gateway methods
1051 Gateway methods are not methods to access a remote host directly.
1052 These methods are intended to pass firewalls or proxy servers.
1053 Therefore, they can be used for proxy host declarations
1054 (@pxref{Multi-hops}) only.
1056 A gateway method must come always along with a method who supports
1057 port setting (referred to as @samp{-p} kludge). This is because
1058 @value{tramp} targets the accompanied method to
1059 @file{localhost#random_port}, from where the firewall or proxy server
1062 Gateway methods support user name and password declarations. These
1063 are used to authenticate towards the corresponding firewall or proxy
1064 server. They can be passed only if your friendly administrator has
1065 granted your access.
1068 @item @option{tunnel}
1069 @cindex method tunnel
1070 @cindex tunnel method
1072 This method implements an HTTP tunnel via the @command{CONNECT}
1073 command (see RFC 2616, 2817). Any HTTP 1.1 compliant (proxy) server
1074 shall support this command.
1076 As authentication method, only @option{Basic Authentication} (see RFC
1077 2617) is implemented so far. If no port number is given in the
1078 declaration, port @option{8080} is used for the proxy server.
1081 @item @option{socks}
1082 @cindex method socks
1083 @cindex socks method
1085 The @command{socks} method provides access to SOCKSv5 servers (see
1086 RFC 1928). @option{Username/Password Authentication} according to RFC
1089 The default port number of the socks server is @option{1080}, if not
1090 specified otherwise.
1096 @node Default Method
1097 @section Selecting a default method
1098 @cindex default method
1100 @vindex tramp-default-method
1101 When you select an appropriate transfer method for your typical usage
1102 you should set the variable @code{tramp-default-method} to reflect that
1103 choice. This variable controls which method will be used when a method
1104 is not specified in the @value{tramp} file name. For example:
1107 (setq tramp-default-method "ssh")
1110 @vindex tramp-default-method-alist
1111 You can also specify different methods for certain user/host
1112 combinations, via the variable @code{tramp-default-method-alist}. For
1113 example, the following two lines specify to use the @option{ssh}
1114 method for all user names matching @samp{john} and the @option{rsync}
1115 method for all host names matching @samp{lily}. The third line
1116 specifies to use the @option{su} method for the user @samp{root} on
1117 the machine @samp{localhost}.
1120 (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
1121 (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1122 (add-to-list 'tramp-default-method-alist
1123 '("\\`localhost\\'" "\\`root\\'" "su"))
1127 See the documentation for the variable
1128 @code{tramp-default-method-alist} for more details.
1130 External transfer methods are normally preferable to inline transfer
1131 methods, giving better performance.
1133 @xref{Inline methods}.
1134 @xref{External transfer methods}.
1136 Another consideration with the selection of transfer methods is the
1137 environment you will use them in and, especially when used over the
1138 Internet, the security implications of your preferred method.
1140 The @option{rsh} and @option{telnet} methods send your password as
1141 plain text as you log in to the remote machine, as well as
1142 transferring the files in such a way that the content can easily be
1143 read from other machines.
1145 If you need to connect to remote systems that are accessible from the
1146 Internet, you should give serious thought to using @option{ssh} based
1147 methods to connect. These provide a much higher level of security,
1148 making it a non-trivial exercise for someone to obtain your password
1149 or read the content of the files you are editing.
1152 @subsection Which method is the right one for me?
1153 @cindex choosing the right method
1155 Given all of the above, you are probably thinking that this is all fine
1156 and good, but it's not helping you to choose a method! Right you are.
1157 As a developer, we don't want to boss our users around but give them
1158 maximum freedom instead. However, the reality is that some users would
1159 like to have some guidance, so here I'll try to give you this guidance
1160 without bossing you around. You tell me whether it works @dots{}
1162 My suggestion is to use an inline method. For large files, out-of-band
1163 methods might be more efficient, but I guess that most people will want
1164 to edit mostly small files.
1166 I guess that these days, most people can access a remote machine by
1167 using @command{ssh}. So I suggest that you use the @option{ssh}
1168 method. So, type @kbd{C-x C-f @trampfn{ssh, root, otherhost,
1169 /etc/motd} @key{RET}} to edit the @file{/etc/motd} file on the other
1172 If you can't use @option{ssh} to log in to the remote host, then
1173 select a method that uses a program that works. For instance, Windows
1174 users might like the @option{plink} method which uses the PuTTY
1175 implementation of @command{ssh}. Or you use Kerberos and thus like
1178 For the special case of editing files on the local host as another
1179 user, see the @option{su} or @option{sudo} methods. They offer
1180 shortened syntax for the @samp{root} account, like
1181 @file{@trampfn{su, , , /etc/motd}}.
1183 People who edit large files may want to consider @option{scpc} instead
1184 of @option{ssh}, or @option{pscp} instead of @option{plink}. These
1185 out-of-band methods are faster than inline methods for large files.
1186 Note, however, that out-of-band methods suffer from some limitations.
1187 Please try first whether you really get a noticeable speed advantage
1188 from using an out-of-band method! Maybe even for large files, inline
1189 methods are fast enough.
1193 @section Selecting a default user
1194 @cindex default user
1196 The user part of a @value{tramp} file name can be omitted. Usually,
1197 it is replaced by the user name you are logged in. Often, this is not
1198 what you want. A typical use of @value{tramp} might be to edit some
1199 files with root permissions on the local host. This case, you should
1200 set the variable @code{tramp-default-user} to reflect that choice.
1204 (setq tramp-default-user "root")
1207 @code{tramp-default-user} is regarded as obsolete, and will be removed
1210 @vindex tramp-default-user-alist
1211 You can also specify different users for certain method/host
1212 combinations, via the variable @code{tramp-default-user-alist}. For
1213 example, if you always have to use the user @samp{john} in the domain
1214 @samp{somewhere.else}, you can specify the following:
1217 (add-to-list 'tramp-default-user-alist
1218 '("ssh" ".*\\.somewhere\\.else\\'" "john"))
1222 See the documentation for the variable
1223 @code{tramp-default-user-alist} for more details.
1225 One trap to fall in must be known. If @value{tramp} finds a default
1226 user, this user will be passed always to the connection command as
1227 parameter (for example @samp{ssh here.somewhere.else -l john}. If you
1228 have specified another user for your command in its configuration
1229 files, @value{tramp} cannot know it, and the remote access will fail.
1230 If you have specified in the given example in @file{~/.ssh/config} the
1234 Host here.somewhere.else
1239 than you must discard selecting a default user by @value{tramp}. This
1240 will be done by setting it to @code{nil} (or @samp{lily}, likewise):
1243 (add-to-list 'tramp-default-user-alist
1244 '("ssh" "\\`here\\.somewhere\\.else\\'" nil))
1247 The last entry in @code{tramp-default-user-alist} could be your
1248 default user you'll apply predominantly. You shall @emph{append} it
1249 to that list at the end:
1252 (add-to-list 'tramp-default-user-alist '(nil nil "jonas") t)
1257 @section Selecting a default host
1258 @cindex default host
1260 @vindex tramp-default-host
1261 Finally, it is even possible to omit the host name part of a
1262 @value{tramp} file name. This case, the value of the variable
1263 @code{tramp-default-host} is used. Per default, it is initialized
1264 with the host name your local @value{emacsname} is running.
1266 If you, for example, use @value{tramp} mainly to contact the host
1267 @samp{target} as user @samp{john}, you can specify:
1270 (setq tramp-default-user "john"
1271 tramp-default-host "target")
1274 Then the simple file name @samp{@trampfn{ssh, , ,}} will connect you
1275 to John's home directory on target.
1277 Note, however, that the most simplification @samp{/::} won't work,
1278 because @samp{/:} is the prefix for quoted file names.
1283 @section Connecting to a remote host using multiple hops
1287 Sometimes, the methods described before are not sufficient. Sometimes,
1288 it is not possible to connect to a remote host using a simple command.
1289 For example, if you are in a secured network, you might have to log in
1290 to a `bastion host' first before you can connect to the outside world.
1291 Of course, the target host may also require a bastion host.
1293 @vindex tramp-default-proxies-alist
1294 In order to specify such multiple hops, it is possible to define a proxy
1295 host to pass through, via the variable
1296 @code{tramp-default-proxies-alist}. This variable keeps a list of
1297 triples (@var{host} @var{user} @var{proxy}).
1299 The first matching item specifies the proxy host to be passed for a
1300 file name located on a remote target matching @var{user}@@@var{host}.
1301 @var{host} and @var{user} are regular expressions or @code{nil}, which
1302 is interpreted as a regular expression which always matches.
1304 @var{proxy} must be a Tramp filename which localname part is ignored.
1305 Method and user name on @var{proxy} are optional, which is interpreted
1306 with the default values.
1308 The method must be an inline or gateway method (@pxref{Inline
1309 methods}, @pxref{Gateway methods}).
1312 The method must be an inline method (@pxref{Inline methods}).
1314 If @var{proxy} is @code{nil}, no additional hop is required reaching
1315 @var{user}@@@var{host}.
1317 If you, for example, must pass the host @samp{bastion.your.domain} as
1318 user @samp{bird} for any remote host which is not located in your local
1322 (add-to-list 'tramp-default-proxies-alist
1323 '("\\." nil "@trampfn{ssh, bird, bastion.your.domain,}"))
1324 (add-to-list 'tramp-default-proxies-alist
1325 '("\\.your\\.domain\\'" nil nil))
1328 Please note the order of the code. @code{add-to-list} adds elements at the
1329 beginning of a list. Therefore, most relevant rules must be added last.
1331 Proxy hosts can be cascaded. If there is another host called
1332 @samp{jump.your.domain}, which is the only one in your local domain who
1333 is allowed connecting @samp{bastion.your.domain}, you can add another
1337 (add-to-list 'tramp-default-proxies-alist
1338 '("\\`bastion\\.your\\.domain\\'"
1340 "@trampfn{ssh, , jump.your.domain,}"))
1343 @var{proxy} can contain the patterns @code{%h} or @code{%u}. These
1344 patterns are replaced by the strings matching @var{host} or
1345 @var{user}, respectively.
1347 If you, for example, wants to work as @samp{root} on hosts in the
1348 domain @samp{your.domain}, but login as @samp{root} is disabled for
1349 non-local access, you might add the following rule:
1352 (add-to-list 'tramp-default-proxies-alist
1353 '("\\.your\\.domain\\'" "\\`root\\'" "@trampfn{ssh, , %h,}"))
1356 Opening @file{@trampfn{sudo, , randomhost.your.domain,}} would connect
1357 first @samp{randomhost.your.domain} via @code{ssh} under your account
1358 name, and perform @code{sudo -u root} on that host afterwards. It is
1359 important to know that the given method is applied on the host which
1360 has been reached so far. @code{sudo -u root}, applied on your local
1361 host, wouldn't be useful here.
1363 This is the recommended configuration to work as @samp{root} on remote
1367 Finally, @code{tramp-default-proxies-alist} can be used to pass
1368 firewalls or proxy servers. Imagine your local network has a host
1369 @samp{proxy.your.domain} which is used on port 3128 as HTTP proxy to
1370 the outer world. Your friendly administrator has granted you access
1371 under your user name to @samp{host.other.domain} on that proxy
1372 server.@footnote{HTTP tunnels are intended for secure SSL/TLS
1373 communication. Therefore, many proxy server restrict the tunnels to
1374 related target ports. You might need to run your ssh server on your
1375 target host @samp{host.other.domain} on such a port, like 443 (https).
1376 See @uref{http://savannah.gnu.org/maintenance/CvsFromBehindFirewall}
1377 for discussion of ethical issues.} You would need to add the
1381 (add-to-list 'tramp-default-proxies-alist
1382 '("\\`host\\.other\\.domain\\'" nil
1383 "@trampfn{tunnel, , proxy.your.domain#3128,}"))
1386 Gateway methods can be declared as first hop only in a multiple hop
1391 @node Customizing Methods
1392 @section Using Non-Standard Methods
1393 @cindex customizing methods
1394 @cindex using non-standard methods
1395 @cindex create your own methods
1397 There is a variable @code{tramp-methods} which you can change if the
1398 predefined methods don't seem right.
1400 For the time being, I'll refer you to the Lisp documentation of that
1401 variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1404 @node Customizing Completion
1405 @section Selecting config files for user/host name completion
1406 @cindex customizing completion
1407 @cindex selecting config files
1408 @vindex tramp-completion-function-alist
1410 The variable @code{tramp-completion-function-alist} is intended to
1411 customize which files are taken into account for user and host name
1412 completion (@pxref{Filename completion}). For every method, it keeps
1413 a set of configuration files, accompanied by a Lisp function able to
1414 parse that file. Entries in @code{tramp-completion-function-alist}
1415 have the form (@var{method} @var{pair1} @var{pair2} ...).
1417 Each @var{pair} is composed of (@var{function} @var{file}).
1418 @var{function} is responsible to extract user names and host names
1419 from @var{file} for completion. There are two functions which access
1422 @defun tramp-get-completion-function method
1423 This function returns the list of completion functions for @var{method}.
1427 (tramp-get-completion-function "rsh")
1429 @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1430 (tramp-parse-rhosts "~/.rhosts"))
1434 @defun tramp-set-completion-function method function-list
1435 This function sets @var{function-list} as list of completion functions
1440 (tramp-set-completion-function "ssh"
1441 '((tramp-parse-sconfig "/etc/ssh_config")
1442 (tramp-parse-sconfig "~/.ssh/config")))
1444 @result{} ((tramp-parse-sconfig "/etc/ssh_config")
1445 (tramp-parse-sconfig "~/.ssh/config"))
1449 The following predefined functions parsing configuration files exist:
1452 @item @code{tramp-parse-rhosts}
1453 @findex tramp-parse-rhosts
1455 This function parses files which are syntactical equivalent to
1456 @file{~/.rhosts}. It returns both host names and user names, if
1459 @item @code{tramp-parse-shosts}
1460 @findex tramp-parse-shosts
1462 This function parses files which are syntactical equivalent to
1463 @file{~/.ssh/known_hosts}. Since there are no user names specified
1464 in such files, it can return host names only.
1466 @item @code{tramp-parse-sconfig}
1467 @findex tramp-parse-shosts
1469 This function returns the host nicknames defined by @code{Host} entries
1470 in @file{~/.ssh/config} style files.
1472 @item @code{tramp-parse-shostkeys}
1473 @findex tramp-parse-shostkeys
1475 SSH2 parsing of directories @file{/etc/ssh2/hostkeys/*} and
1476 @file{~/ssh2/hostkeys/*}. Hosts are coded in file names
1477 @file{hostkey_@var{portnumber}_@var{host-name}.pub}. User names
1478 are always @code{nil}.
1480 @item @code{tramp-parse-sknownhosts}
1481 @findex tramp-parse-shostkeys
1483 Another SSH2 style parsing of directories like
1484 @file{/etc/ssh2/knownhosts/*} and @file{~/ssh2/knownhosts/*}. This
1485 case, hosts names are coded in file names
1486 @file{@var{host-name}.@var{algorithm}.pub}. User names are always @code{nil}.
1488 @item @code{tramp-parse-hosts}
1489 @findex tramp-parse-hosts
1491 A function dedicated to @file{/etc/hosts} style files. It returns
1494 @item @code{tramp-parse-passwd}
1495 @findex tramp-parse-passwd
1497 A function which parses @file{/etc/passwd} like files. Obviously, it
1498 can return user names only.
1500 @item @code{tramp-parse-netrc}
1501 @findex tramp-parse-netrc
1503 Finally, a function which parses @file{~/.netrc} like files.
1506 If you want to keep your own data in a file, with your own structure,
1507 you might provide such a function as well. This function must meet
1508 the following conventions:
1510 @defun my-tramp-parse file
1511 @var{file} must be either a file name on your host, or @code{nil}.
1512 The function must return a list of (@var{user} @var{host}), which are
1513 taken as candidates for user and host name completion.
1517 (my-tramp-parse "~/.my-tramp-hosts")
1519 @result{} ((nil "toto") ("daniel" "melancholia"))
1524 @node Password caching
1525 @section Reusing passwords for several connections.
1528 Sometimes it is necessary to connect to the same remote host several
1529 times. Reentering passwords again and again would be annoying, when
1530 the chosen method does not support access without password prompt
1531 through own configuration.
1533 By default, @value{tramp} caches the passwords entered by you. They will
1534 be reused next time if a connection needs them for the same user name
1535 and host name, independently of the connection method.
1537 @vindex password-cache-expiry
1538 Passwords are not saved permanently, that means the password caching
1539 is limited to the lifetime of your @value{emacsname} session. You
1540 can influence the lifetime of password caching by customizing the
1541 variable @code{password-cache-expiry}. The value is the number of
1542 seconds how long passwords are cached. Setting it to @code{nil}
1543 disables the expiration.
1545 @vindex password-cache
1546 If you don't like this feature for security reasons, password caching
1547 can be disabled totally by customizing the variable
1548 @code{password-cache} (setting it to @code{nil}).
1550 Implementation Note: password caching is based on the package
1551 @file{password.el} in No Gnus. For the time being, it is activated
1552 only when this package is seen in the @code{load-path} while loading
1554 @ifset installchapter
1555 If you don't use No Gnus, you can take @file{password.el} from the
1556 @value{tramp} @file{contrib} directory, see @ref{Installation
1559 It will be activated mandatory once No Gnus has found its way into
1563 @node Connection caching
1564 @section Reusing connection related information.
1567 @vindex tramp-persistency-file-name
1568 In order to reduce initial connection time, @value{tramp} stores
1569 connection related information persistently. The variable
1570 @code{tramp-persistency-file-name} keeps the file name where these
1571 information are written. Its default value is
1573 @file{~/.emacs.d/tramp}.
1576 @file{~/.xemacs/tramp}.
1578 It is recommended to choose a local file name.
1580 @value{tramp} reads this file during startup, and writes it when
1581 exiting @value{emacsname}. You can simply remove this file if
1582 @value{tramp} shall be urged to recompute these information next
1583 @value{emacsname} startup time.
1585 Using such persistent information can be disabled by setting
1586 @code{tramp-persistency-file-name} to @code{nil}.
1588 Once consequence of reusing connection related information is that
1589 @var{tramp} needs to distinguish hosts. If you, for example, run a
1590 local @code{sshd} on port 3001, which tunnels @command{ssh} to another
1591 host, you could access both @file{@trampfn{ssh, , localhost,}} and
1592 @file{@trampfn{ssh, , localhost#3001,}}. @var{tramp} would use the
1593 same host related information (like paths, Perl variants, etc) for
1594 both connections, although the information is valid only for one of
1597 In order to avoid trouble, you must use another host name for one of
1598 the connections, like introducing a @option{Host} section in
1599 @file{~/.ssh/config} (@pxref{Frequently Asked Questions}) or applying
1600 multiple hops (@pxref{Multi-hops}).
1602 When @value{tramp} detects a changed operating system version on a
1603 remote host (via the command @command{uname -sr}), it flushes all
1604 connection related information for this host, quits the execution, and
1605 displays a message like this:
1608 Quit: "Connection reset, because remote host changed from `Linux
1609 2.6.22-13-generic' to `Linux 2.6.22-14-generic'"
1613 You can simply open the remote file again in such a case.
1616 @node Remote Programs
1617 @section How @value{tramp} finds and uses programs on the remote machine.
1619 @value{tramp} depends on a number of programs on the remote host in order to
1620 function, including @command{ls}, @command{test}, @command{find} and
1623 In addition to these required tools, there are various tools that may be
1624 required based on the connection method. See @ref{Inline methods} and
1625 @ref{External transfer methods} for details on these.
1627 Certain other tools, such as @command{perl} (or @command{perl5}) and
1628 @command{grep} will be used if they can be found. When they are
1629 available, they are used to improve the performance and accuracy of
1632 @vindex tramp-remote-path
1633 When @value{tramp} connects to the remote machine, it searches for the
1634 programs that it can use. The variable @code{tramp-remote-path}
1635 controls the directories searched on the remote machine.
1637 By default, this is set to a reasonable set of defaults for most
1638 machines. The symbol @code{tramp-default-remote-path} is a place
1639 holder, it is replaced by the list of directories received via the
1640 command @command{getconf PATH} on your remote machine. For example,
1641 on GNU Debian this is @file{/bin:/usr/bin}, whereas on Solaris this is
1642 @file{/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin}. It is
1643 recommended to apply this symbol on top of @code{tramp-remote-path}.
1645 It is possible, however, that your local (or remote ;) system
1646 administrator has put the tools you want in some obscure local
1649 In this case, you can still use them with @value{tramp}. You simply
1650 need to add code to your @file{.emacs} to add the directory to the
1651 remote path. This will then be searched by @value{tramp} when you
1652 connect and the software found.
1654 To add a directory to the remote search path, you could use code such
1658 @i{;; We load @value{tramp} to define the variable.}
1660 @i{;; We have @command{perl} in "/usr/local/perl/bin"}
1661 (add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1664 @value{tramp} caches several information, like the Perl binary
1665 location. The changed remote search path wouldn't affect these
1666 settings. In order to force @value{tramp} to recompute these values,
1667 you must exit @value{emacsname}, remove your persistency file
1668 (@pxref{Connection caching}), and restart @value{emacsname}.
1671 @node Remote shell setup
1672 @section Remote shell setup hints
1673 @cindex remote shell setup
1674 @cindex @file{.profile} file
1675 @cindex @file{.login} file
1676 @cindex shell init files
1678 As explained in the @ref{Overview} section, @value{tramp} connects to the
1679 remote host and talks to the shell it finds there. Of course, when you
1680 log in, the shell executes its init files. Suppose your init file
1681 requires you to enter the birth date of your mother; clearly @value{tramp}
1682 does not know this and hence fails to log you in to that host.
1684 There are different possible strategies for pursuing this problem. One
1685 strategy is to enable @value{tramp} to deal with all possible situations.
1686 This is a losing battle, since it is not possible to deal with
1687 @emph{all} situations. The other strategy is to require you to set up
1688 the remote host such that it behaves like @value{tramp} expects. This might
1689 be inconvenient because you have to invest a lot of effort into shell
1690 setup before you can begin to use @value{tramp}.
1692 The package, therefore, pursues a combined approach. It tries to
1693 figure out some of the more common setups, and only requires you to
1694 avoid really exotic stuff. For example, it looks through a list of
1695 directories to find some programs on the remote host. And also, it
1696 knows that it is not obvious how to check whether a file exists, and
1697 therefore it tries different possibilities. (On some hosts and
1698 shells, the command @command{test -e} does the trick, on some hosts
1699 the shell builtin doesn't work but the program @command{/usr/bin/test
1700 -e} or @command{/bin/test -e} works. And on still other hosts,
1701 @command{ls -d} is the right way to do this.)
1703 Below you find a discussion of a few things that @value{tramp} does not deal
1704 with, and that you therefore have to set up correctly.
1707 @item @var{shell-prompt-pattern}
1708 @vindex shell-prompt-pattern
1710 After logging in to the remote host, @value{tramp} has to wait for the remote
1711 shell startup to finish before it can send commands to the remote
1712 shell. The strategy here is to wait for the shell prompt. In order to
1713 recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1714 to be set correctly to recognize the shell prompt on the remote host.
1716 Note that @value{tramp} requires the match for @code{shell-prompt-pattern}
1717 to be at the end of the buffer. Many people have something like the
1718 following as the value for the variable: @code{"^[^>$][>$] *"}. Now
1719 suppose your shell prompt is @code{a <b> c $ }. In this case,
1720 @value{tramp} recognizes the @code{>} character as the end of the prompt,
1721 but it is not at the end of the buffer.
1723 @item @var{tramp-shell-prompt-pattern}
1724 @vindex tramp-shell-prompt-pattern
1726 This regular expression is used by @value{tramp} in the same way as
1727 @code{shell-prompt-pattern}, to match prompts from the remote shell.
1728 This second variable exists because the prompt from the remote shell
1729 might be different from the prompt from a local shell --- after all,
1730 the whole point of @value{tramp} is to log in to remote hosts as a
1731 different user. The default value of
1732 @code{tramp-shell-prompt-pattern} is the same as the default value of
1733 @code{shell-prompt-pattern}, which is reported to work well in many
1736 @item @var{tramp-password-prompt-regexp}
1737 @vindex tramp-password-prompt-regexp
1738 @vindex tramp-wrong-passwd-regexp
1740 During login, @value{tramp} might be forced to enter a password or a
1741 passphrase. The difference between both is that a password is
1742 requested from the shell on the remote host, while a passphrase is
1743 needed for accessing local authentication information, like your ssh
1746 @var{tramp-password-prompt-regexp} handles the detection of such
1747 requests for English environments. When you use another localization
1748 of your (local or remote) host, you might need to adapt this. Example:
1752 tramp-password-prompt-regexp
1756 '("passphrase" "Passphrase"
1758 "password" "Password"
1760 "passwort" "Passwort"
1762 "mot de passe" "Mot de passe") t)
1766 In parallel, it might also be necessary to adapt
1767 @var{tramp-wrong-passwd-regexp}.
1769 @item @command{tset} and other questions
1770 @cindex Unix command tset
1771 @cindex tset Unix command
1773 Some people invoke the @command{tset} program from their shell startup
1774 scripts which asks the user about the terminal type of the shell.
1775 Maybe some shells ask other questions when they are started.
1776 @value{tramp} does not know how to answer these questions. There are
1777 two approaches for dealing with this problem. One approach is to take
1778 care that the shell does not ask any questions when invoked from
1779 @value{tramp}. You can do this by checking the @code{TERM}
1780 environment variable, it will be set to @code{dumb} when connecting.
1782 @vindex tramp-terminal-type
1783 The variable @code{tramp-terminal-type} can be used to change this value
1786 @vindex tramp-actions-before-shell
1787 The other approach is to teach @value{tramp} about these questions. See
1788 the variable @code{tramp-actions-before-shell}. Example:
1791 (defconst my-tramp-prompt-regexp
1792 (concat (regexp-opt '("Enter the birth date of your mother:") t)
1794 "Regular expression matching my login prompt question.")
1796 (defun my-tramp-action (proc vec)
1797 "Enter \"19000101\" in order to give a correct answer."
1798 (save-window-excursion
1799 (with-current-buffer (tramp-get-connection-buffer vec)
1800 (tramp-message vec 6 "\n%s" (buffer-string))
1801 (tramp-send-string vec "19000101"))))
1803 (add-to-list 'tramp-actions-before-shell
1804 '(my-tramp-prompt-regexp my-tramp-action))
1808 @item Environment variables named like users in @file{.profile}
1810 If you have a user named frumple and set the variable @code{FRUMPLE} in
1811 your shell environment, then this might cause trouble. Maybe rename
1812 the variable to @code{FRUMPLE_DIR} or the like.
1814 This weird effect was actually reported by a @value{tramp} user!
1817 @item Non-Bourne commands in @file{.profile}
1819 After logging in to the remote host, @value{tramp} issues the command
1820 @command{exec /bin/sh}. (Actually, the command is slightly
1821 different.) When @command{/bin/sh} is executed, it reads some init
1822 files, such as @file{~/.shrc} or @file{~/.profile}.
1824 Now, some people have a login shell which is not @code{/bin/sh} but a
1825 Bourne-ish shell such as bash or ksh. Some of these people might put
1826 their shell setup into the files @file{~/.shrc} or @file{~/.profile}.
1827 This way, it is possible for non-Bourne constructs to end up in those
1828 files. Then, @command{exec /bin/sh} might cause the Bourne shell to
1829 barf on those constructs.
1831 As an example, imagine somebody putting @command{export FOO=bar} into
1832 the file @file{~/.profile}. The standard Bourne shell does not
1833 understand this syntax and will emit a syntax error when it reaches
1836 Another example is the tilde (@code{~}) character, say when adding
1837 @file{~/bin} to @code{$PATH}. Many Bourne shells will not expand this
1838 character, and since there is usually no directory whose name consists
1839 of the single character tilde, strange things will happen.
1841 What can you do about this?
1843 Well, one possibility is to make sure that everything in
1844 @file{~/.shrc} and @file{~/.profile} on all remote hosts is
1845 Bourne-compatible. In the above example, instead of @command{export
1846 FOO=bar}, you might use @command{FOO=bar; export FOO} instead.
1848 The other possibility is to put your non-Bourne shell setup into some
1849 other files. For example, bash reads the file @file{~/.bash_profile}
1850 instead of @file{~/.profile}, if the former exists. So bash
1851 aficionados just rename their @file{~/.profile} to
1852 @file{~/.bash_profile} on all remote hosts, and Bob's your uncle.
1854 The @value{tramp} developers would like to circumvent this problem, so
1855 if you have an idea about it, please tell us. However, we are afraid
1856 it is not that simple: before saying @command{exec /bin/sh},
1857 @value{tramp} does not know which kind of shell it might be talking
1858 to. It could be a Bourne-ish shell like ksh or bash, or it could be a
1859 csh derivative like tcsh, or it could be zsh, or even rc. If the
1860 shell is Bourne-ish already, then it might be prudent to omit the
1861 @command{exec /bin/sh} step. But how to find out if the shell is
1867 @node Auto-save and Backup
1868 @section Auto-save and Backup configuration
1872 @vindex backup-directory-alist
1875 @vindex bkup-backup-directory-info
1878 Normally, @value{emacsname} writes backup files to the same directory
1879 as the original files, but this behavior can be changed via the
1882 @code{backup-directory-alist}.
1885 @code{bkup-backup-directory-info}.
1887 In connection with @value{tramp}, this can have unexpected side
1888 effects. Suppose that you specify that all backups should go to the
1889 directory @file{~/.emacs.d/backups/}, and then you edit the file
1890 @file{@trampfn{su, root, localhost, /etc/secretfile}}. The effect is
1891 that the backup file will be owned by you and not by root, thus
1892 possibly enabling others to see it even if they were not intended to
1897 @code{backup-directory-alist}
1900 @code{bkup-backup-directory-info}
1902 is @code{nil} (the default), such problems do not occur.
1904 Therefore, it is useful to set special values for @value{tramp}
1905 files. For example, the following statement effectively `turns off'
1908 @code{backup-directory-alist}
1911 @code{bkup-backup-directory-info}
1913 for @value{tramp} files:
1917 (add-to-list 'backup-directory-alist
1918 (cons tramp-file-name-regexp nil))
1923 (require 'backup-dir)
1924 (add-to-list 'bkup-backup-directory-info
1925 (list tramp-file-name-regexp ""))
1929 Another possibility is to use the @value{tramp} variable
1931 @code{tramp-backup-directory-alist}.
1934 @code{tramp-bkup-backup-directory-info}.
1936 This variable has the same meaning like
1938 @code{backup-directory-alist}.
1941 @code{bkup-backup-directory-info}.
1943 If a @value{tramp} file is backed up, and DIRECTORY is an absolute
1944 local file name, DIRECTORY is prepended with the @value{tramp} file
1945 name prefix of the file to be backed up.
1952 (add-to-list 'backup-directory-alist
1953 (cons "." "~/.emacs.d/backups/"))
1954 (setq tramp-backup-directory-alist backup-directory-alist)
1959 (require 'backup-dir)
1960 (add-to-list 'bkup-backup-directory-info
1961 (list "." "~/.emacs.d/backups/" 'full-path))
1962 (setq tramp-bkup-backup-directory-info bkup-backup-directory-info)
1967 The backup file name of @file{@trampfn{su, root, localhost,
1968 /etc/secretfile}} would be
1970 @file{@trampfn{su, root, localhost,
1971 ~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile~}}
1974 @file{@trampfn{su, root, localhost,
1975 ~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}}
1978 The same problem can happen with auto-saving files.
1980 Since @value{emacsname} 21, the variable
1981 @code{auto-save-file-name-transforms} keeps information, on which
1982 directory an auto-saved file should go. By default, it is initialized
1983 for @value{tramp} files to the local temporary directory.
1985 On some versions of @value{emacsname}, namely the version built for
1986 Debian GNU/Linux, the variable @code{auto-save-file-name-transforms}
1987 contains the directory where @value{emacsname} was built. A
1988 workaround is to manually set the variable to a sane value.
1990 If auto-saved files should go into the same directory as the original
1991 files, @code{auto-save-file-name-transforms} should be set to @code{nil}.
1993 Another possibility is to set the variable
1994 @code{tramp-auto-save-directory} to a proper value.
1997 For this purpose you can set the variable @code{auto-save-directory}
2002 @node Windows setup hints
2003 @section Issues with Cygwin ssh
2004 @cindex Cygwin, issues
2006 This section needs a lot of work! Please help.
2008 @cindex method sshx with Cygwin
2009 @cindex sshx method with Cygwin
2010 The recent Cygwin installation of @command{ssh} works only with a
2011 Cygwinized @value{emacsname}. You can check it by typing @kbd{M-x
2012 eshell}, and starting @kbd{ssh test.machine}. The problem is evident
2013 if you see a message like this:
2016 Pseudo-terminal will not be allocated because stdin is not a terminal.
2019 Older @command{ssh} versions of Cygwin are told to cooperate with
2020 @value{tramp} selecting @option{sshx} as the connection method. You
2021 can find information about setting up Cygwin in their FAQ at
2022 @uref{http://cygwin.com/faq/}.
2024 @cindex method scpx with Cygwin
2025 @cindex scpx method with Cygwin
2026 If you wish to use the @option{scpx} connection method, then you might
2027 have the problem that @value{emacsname} calls @command{scp} with a
2028 Windows filename such as @code{c:/foo}. The Cygwin version of
2029 @command{scp} does not know about Windows filenames and interprets
2030 this as a remote filename on the host @code{c}.
2032 One possible workaround is to write a wrapper script for @option{scp}
2033 which converts the Windows filename to a Cygwinized filename.
2035 @cindex Cygwin and ssh-agent
2036 @cindex SSH_AUTH_SOCK and @value{emacsname} on Windows
2037 If you want to use either @option{ssh} based method on Windows, then
2038 you might encounter problems with @command{ssh-agent}. Using this
2039 program, you can avoid typing the pass-phrase every time you log in.
2040 However, if you start @value{emacsname} from a desktop shortcut, then
2041 the environment variable @code{SSH_AUTH_SOCK} is not set and so
2042 @value{emacsname} and thus @value{tramp} and thus @command{ssh} and
2043 @command{scp} started from @value{tramp} cannot communicate with
2044 @command{ssh-agent}. It works better to start @value{emacsname} from
2047 If anyone knows how to start @command{ssh-agent} under Windows in such a
2048 way that desktop shortcuts can profit, please holler. I don't really
2049 know anything at all about Windows@dots{}
2053 @chapter Using @value{tramp}
2054 @cindex using @value{tramp}
2056 Once you have installed @value{tramp} it will operate fairly
2057 transparently. You will be able to access files on any remote machine
2058 that you can log in to as though they were local.
2060 Files are specified to @value{tramp} using a formalized syntax specifying the
2061 details of the system to connect to. This is similar to the syntax used
2062 by the @value{ftppackagename} package.
2065 Something that might happen which surprises you is that
2066 @value{emacsname} remembers all your keystrokes, so if you see a
2067 password prompt from @value{emacsname}, say, and hit @kbd{@key{RET}}
2068 twice instead of once, then the second keystroke will be processed by
2069 @value{emacsname} after @value{tramp} has done its thing. Why, this
2070 type-ahead is normal behavior, you say. Right you are, but be aware
2071 that opening a remote file might take quite a while, maybe half a
2072 minute when a connection needs to be opened. Maybe after half a
2073 minute you have already forgotten that you hit that key!
2076 * Filename Syntax:: @value{tramp} filename conventions.
2077 * Alternative Syntax:: URL-like filename syntax.
2078 * Filename completion:: Filename completion.
2079 * Remote processes:: Integration with other @value{emacsname} packages.
2080 * Cleanup remote connections:: Cleanup remote connections.
2084 @node Filename Syntax
2085 @section @value{tramp} filename conventions
2086 @cindex filename syntax
2087 @cindex filename examples
2089 To access the file @var{localname} on the remote machine @var{machine}
2090 you would specify the filename @file{@trampfn{, , machine,
2091 localname}}. This will connect to @var{machine} and transfer the file
2092 using the default method. @xref{Default Method}.
2094 Some examples of @value{tramp} filenames are shown below.
2097 @item @trampfn{, , melancholia, .emacs}
2098 Edit the file @file{.emacs} in your home directory on the machine
2101 @item @trampfn{, , melancholia.danann.net, .emacs}
2102 This edits the same file, using the fully qualified domain name of
2105 @item @trampfn{, , melancholia, ~/.emacs}
2106 This also edits the same file --- the @file{~} is expanded to your
2107 home directory on the remote machine, just like it is locally.
2109 @item @trampfn{, , melancholia, ~daniel/.emacs}
2110 This edits the file @file{.emacs} in the home directory of the user
2111 @code{daniel} on the machine @code{melancholia}. The @file{~<user>}
2112 construct is expanded to the home directory of that user on the remote
2115 @item @trampfn{, , melancholia, /etc/squid.conf}
2116 This edits the file @file{/etc/squid.conf} on the machine
2121 Unless you specify a different name to use, @value{tramp} will use the
2122 current local user name as the remote user name to log in with. If you
2123 need to log in as a different user, you can specify the user name as
2124 part of the filename.
2126 To log in to the remote machine as a specific user, you use the syntax
2127 @file{@trampfn{, user, machine, path/to.file}}. That means that
2128 connecting to @code{melancholia} as @code{daniel} and editing
2129 @file{.emacs} in your home directory you would specify
2130 @file{@trampfn{, daniel, melancholia, .emacs}}.
2132 It is also possible to specify other file transfer methods
2133 (@pxref{Inline methods}, @pxref{External transfer methods}) as part of
2136 This is done by putting the method before the user and host name, as
2137 in @file{@value{prefix}@var{method}@value{postfixhop}} (Note the
2141 This is done by replacing the initial @file{@value{prefix}} with
2142 @file{@value{prefix}<method>@value{postfixhop}}. (Note the trailing
2145 The user, machine and file specification remain the same.
2147 So, to connect to the machine @code{melancholia} as @code{daniel},
2148 using the @option{ssh} method to transfer files, and edit
2149 @file{.emacs} in my home directory I would specify the filename
2150 @file{@trampfn{ssh, daniel, melancholia, .emacs}}.
2153 @node Alternative Syntax
2154 @section URL-like filename syntax
2155 @cindex filename syntax
2156 @cindex filename examples
2158 Additionally to the syntax described in the previous chapter, it is
2159 possible to use a URL-like syntax for @value{tramp}. This can be
2160 switched on by customizing the variable @code{tramp-syntax}. Please
2161 note that this feature is experimental for the time being.
2163 The variable @code{tramp-syntax} must be set before requiring @value{tramp}:
2166 (setq tramp-syntax 'url)
2170 Then, a @value{tramp} filename would look like this:
2171 @file{/@var{method}://@var{user}@@@var{machine}:@var{port}/@var{path/to.file}}.
2172 @file{/@var{method}://} is mandatory, all other parts are optional.
2173 @file{:@var{port}} is useful for methods only who support this.
2175 The last example from the previous section would look like this:
2176 @file{/ssh://daniel@@melancholia/.emacs}.
2178 For the time being, @code{tramp-syntax} can have the following values:
2182 @item @code{ftp} -- That is the default syntax
2183 @item @code{url} -- URL-like syntax
2186 @item @code{sep} -- That is the default syntax
2187 @item @code{url} -- URL-like syntax
2188 @item @code{ftp} -- EFS-like syntax
2193 @node Filename completion
2194 @section Filename completion
2195 @cindex filename completion
2197 Filename completion works with @value{tramp} for completion of method
2198 names, of user names and of machine names as well as for completion of
2199 file names on remote machines.
2201 In order to enable this, Partial Completion mode must be set on.
2203 @xref{Completion Options, , , @value{emacsdir}}.
2207 If you, for example, type @kbd{C-x C-f @value{prefix}t
2208 @key{TAB}}, @value{tramp} might give you as result the choice for
2212 @value{prefixhop}telnet@value{postfixhop} tmp/
2213 @value{prefixhop}toto@value{postfix}
2216 @value{prefixhop}telnet@value{postfixhop} @value{prefixhop}toto@value{postfix}
2220 @samp{@value{prefixhop}telnet@value{postfixhop}}
2221 is a possible completion for the respective method,
2223 @samp{tmp/} stands for the directory @file{/tmp} on your local
2226 and @samp{@value{prefixhop}toto@value{postfix}}
2227 might be a host @value{tramp} has detected in your @file{~/.ssh/known_hosts}
2228 file (given you're using default method @option{ssh}).
2230 If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
2231 @samp{@value{prefix}telnet@value{postfixhop}}.
2232 Next @kbd{@key{TAB}} brings you all machine names @value{tramp} detects in
2233 your @file{/etc/hosts} file, let's say
2236 @trampfn{telnet, , 127.0.0.1,} @trampfn{telnet, , 192.168.0.1,}
2237 @trampfn{telnet, , localhost,} @trampfn{telnet, , melancholia.danann.net,}
2238 @trampfn{telnet, , melancholia,}
2241 Now you can choose the desired machine, and you can continue to
2242 complete file names on that machine.
2244 If the configuration files (@pxref{Customizing Completion}), which
2245 @value{tramp} uses for analysis of completion, offer user names, those user
2246 names will be taken into account as well.
2248 Remote machines, which have been visited in the past and kept
2249 persistently (@pxref{Connection caching}), will be offered too.
2251 Once the remote machine identification is completed, it comes to
2252 filename completion on the remote host. This works pretty much like
2253 for files on the local host, with the exception that minibuffer
2254 killing via a double-slash works only on the filename part, except
2255 that filename part starts with @file{//}.
2257 A triple-slash stands for the default behaviour.
2260 @xref{Minibuffer File, , , @value{emacsdir}}.
2268 @kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//etc} @key{TAB}}
2269 @print{} @trampfn{telnet, , melancholia, /etc}
2271 @kbd{C-x C-f @trampfn{telnet, , melancholia, //etc} @key{TAB}}
2274 @kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin///etc} @key{TAB}}
2279 @kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//}}
2280 @print{} @trampfn{telnet, , melancholia, /}
2282 @kbd{C-x C-f @trampfn{telnet, , melancholia, //}}
2287 A remote directory might have changed its contents out of
2288 @value{emacsname} control, for example by creation or deletion of
2289 files by other processes. Therefore, during filename completion the
2290 remote directory contents is reread regularly in order to detect such
2291 changes, which would be invisible otherwise (@pxref{Connection caching}).
2293 @defopt tramp-completion-reread-directory-timeout
2294 This variable defines the number of seconds since last remote command
2295 before rereading a directory contents. A value of 0 would require an
2296 immediate reread during filename completion, @code{nil} means to use
2297 always cached values for the directory contents.
2301 @node Remote processes
2302 @section Integration with other @value{emacsname} packages.
2306 @value{tramp} supports running processes on a remote host. This
2307 allows to exploit @value{emacsname} packages without modification for
2308 remote file names. It does not work for the @option{ftp} and
2309 @option{smb} methods.
2311 Remote processes are started when a corresponding command is executed
2312 from a buffer belonging to a remote file or directory. Up to now, the
2313 packages @file{compile.el} (commands like @code{compile} and
2314 @code{grep}) and @file{gud.el} (@code{gdb} or @code{perldb}) have been
2315 integrated. Integration of further packages is planned, any help for
2318 When your program is not found in the default search path
2319 @value{tramp} sets on the remote machine, you should either use an
2320 absolute path, or extend @code{tramp-remote-path} (see @ref{Remote
2324 (add-to-list 'tramp-remote-path "~/bin")
2325 (add-to-list 'tramp-remote-path "/appli/pub/bin")
2328 The environment for your program can be adapted by customizing
2329 @code{tramp-remote-process-environment}. This variable is a list of
2330 strings. It is structured like @code{process-environment}. Each
2331 element is a string of the form ENVVARNAME=VALUE. An entry
2332 ENVVARNAME= disables the corresponding environment variable, which
2333 might have been set in your init file like @file{~/.profile}.
2336 Adding an entry can be performed via @code{add-to-list}:
2339 (add-to-list 'tramp-remote-process-environment "JAVA_HOME=/opt/java")
2342 Changing or removing an existing entry is not encouraged. The default
2343 values are chosen for proper @value{tramp} work. Nevertheless, if for
2344 example a paranoid system administrator disallows changing the
2345 @var{$HISTORY} environment variable, you can customize
2346 @code{tramp-remote-process-environment}, or you can apply the
2347 following code in your @file{.emacs}:
2350 (let ((process-environment tramp-remote-process-environment))
2351 (setenv "HISTORY" nil)
2352 (setq tramp-remote-process-environment process-environment))
2355 If you use other @value{emacsname} packages which do not run
2356 out-of-the-box on a remote host, please let us know. We will try to
2357 integrate them as well. @xref{Bug Reports}.
2360 @subsection Running shell-command on a remote host
2361 @cindex shell-command
2363 @code{shell-command} allows to execute commands in a shell, either
2364 synchronously, either asynchronously. This works also on remote
2368 @kbd{C-x C-f @trampfn{sudo, , , } @key{RET}}
2369 @kbd{M-! tail -f /var/log/syslog.log & @key{RET}}
2372 You will see the buffer @file{*Async Shell Command*}, containing the
2373 continous output of the @command{tail} command.
2376 @subsection Running eshell on a remote host
2379 @value{tramp} is integrated into @file{eshell.el}. That is, you can
2380 open an interactive shell on your remote host, and run commands there.
2381 After you have started @code{eshell}, you could perform commands like
2385 @b{~ $} cd @trampfn{sudo, , , /etc} @key{RET}
2386 @b{@trampfn{sudo, root, host, /etc} $} hostname @key{RET}
2388 @b{@trampfn{sudo, root, host, /etc} $} id @key{RET}
2389 uid=0(root) gid=0(root) groups=0(root)
2390 @b{@trampfn{sudo, root, host, /etc} $} find-file shadow @key{RET}
2392 @b{@trampfn{sudo, root, host, /etc} $}
2396 @anchor{Running a debugger on a remote host}
2397 @subsection Running a debugger on a remote host
2402 @file{gud.el} offers an unified interface to several symbolic
2406 (@ref{Debuggers, , , @value{emacsdir}}).
2409 With @value{tramp}, it is possible to debug programs on
2410 remote hosts. You can call @code{gdb} with a remote file name:
2413 @kbd{M-x gdb @key{RET}}
2414 @b{Run gdb (like this):} gdb --annotate=3 @trampfn{ssh, , host, ~/myprog} @key{RET}
2417 The file name can also be relative to a remote default directory.
2418 Given you are in a buffer that belongs to the remote directory
2419 @trampfn{ssh, , host, /home/user}, you could call
2422 @kbd{M-x perldb @key{RET}}
2423 @b{Run perldb (like this):} perl -d myprog.pl @key{RET}
2426 It is not possible to use just the absolute local part of a remote
2427 file name as program to debug, like @kbd{perl -d
2428 /home/user/myprog.pl}, though.
2430 Arguments of the program to be debugged are taken literally. That
2431 means, file names as arguments must be given as ordinary relative or
2432 absolute file names, without any remote specification.
2435 @node Cleanup remote connections
2436 @section Cleanup remote connections.
2439 Sometimes it is useful to cleanup remote connections. The following
2440 commands support this.
2442 @deffn Command tramp-cleanup-connection vec
2443 This command flushes all connection related objects. @option{vec} is
2444 the internal representation of a remote connection. Called
2445 interactively, the command offers all active remote connections in the
2446 minibuffer as remote file name prefix like @file{@trampfn{method,
2447 user, host, }}. The cleanup includes password cache (@pxref{Password
2448 caching}), file cache, connection cache (@pxref{Connection caching}),
2452 @deffn Command tramp-cleanup-all-connections
2453 This command flushes objects for all active remote connections. The
2454 same objects are removed as in @code{tramp-cleanup-connection}.
2457 @deffn Command tramp-cleanup-all-buffers
2458 Like in @code{tramp-cleanup-all-connections}, all remote connections
2459 are cleaned up. Additionally all buffers, which are related to a
2460 remote connection, are killed.
2465 @chapter Reporting Bugs and Problems
2468 Bugs and problems with @value{tramp} are actively worked on by the
2469 development team. Feature requests and suggestions are also more than
2472 The @value{tramp} mailing list is a great place to get information on
2473 working with @value{tramp}, solving problems and general discussion
2474 and advice on topics relating to the package. It is moderated so
2475 non-subscribers can post but messages will be delayed, possibly up to
2476 48 hours (or longer in case of holidays), until the moderator approves
2479 The mailing list is at @email{tramp-devel@@gnu.org}. Messages sent to
2480 this address go to all the subscribers. This is @emph{not} the address
2481 to send subscription requests to.
2483 Subscribing to the list is performed via
2484 @uref{http://lists.gnu.org/mailman/listinfo/tramp-devel/,
2485 the @value{tramp} Mail Subscription Page}.
2488 To report a bug in @value{tramp}, you should execute @kbd{M-x
2489 tramp-bug}. This will automatically generate a buffer with the details
2490 of your system and @value{tramp} version.
2492 When submitting a bug report, please try to describe in excruciating
2493 detail the steps required to reproduce the problem, the setup of the
2494 remote machine and any special conditions that exist. You should also
2495 check that your problem is not described already in @xref{Frequently
2498 If you can identify a minimal test case that reproduces the problem,
2499 include that with your bug report. This will make it much easier for
2500 the development team to analyze and correct the problem.
2502 Before reporting the bug, you should set the verbosity level to 6
2503 (@pxref{Traces and Profiles, Traces}) in the @file{~/.emacs} file and
2504 repeat the bug. Then, include the contents of the @file{*tramp/foo*}
2505 and @file{*debug tramp/foo*} buffers in your bug report. A verbosity
2506 level greater than 6 will produce a very huge debug buffer, which is
2507 mostly not necessary for the analysis.
2509 Please be aware that, with a verbosity level of 6 or greater, the
2510 contents of files and directories will be included in the debug
2511 buffer. Passwords you've typed will never be included there.
2514 @node Frequently Asked Questions
2515 @chapter Frequently Asked Questions
2516 @cindex frequently asked questions
2521 Where can I get the latest @value{tramp}?
2523 @value{tramp} is available under the URL below.
2526 @uref{ftp://ftp.gnu.org/gnu/tramp/}
2529 There is also a Savannah project page.
2532 @uref{http://savannah.gnu.org/projects/tramp/}
2536 Which systems does it work on?
2538 The package has been used successfully on GNU Emacs 21, GNU Emacs 22
2539 and XEmacs 21 (starting with 21.4). Gateway methods are supported for
2542 The package was intended to work on Unix, and it really expects a
2543 Unix-like system on the remote end (except the @option{smb} method),
2544 but some people seemed to have some success getting it to work on MS
2545 Windows NT/2000/XP @value{emacsname}.
2547 There is some informations on @value{tramp} on NT at the following URL;
2548 many thanks to Joe Stoy for providing the information:
2549 @uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}
2551 @c The link is broken. I've contacted Tom for clarification. Michael.
2553 The above mostly contains patches to old ssh versions; Tom Roche has a
2554 Web page with instructions:
2555 @uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
2559 How could I speed up @value{tramp}?
2561 In the backstage, @value{tramp} needs a lot of operations on the
2562 remote host. The time for transferring data from and to the remote
2563 host as well as the time needed to perform the operations there count.
2564 In order to speed up @value{tramp}, one could either try to avoid some
2565 of the operations, or one could try to improve their performance.
2567 Use an external transfer method, like @option{scpc}.
2569 Use caching. This is already enabled by default. Information about
2570 the remote host as well as the remote files are cached for reuse. The
2571 information about remote hosts is kept in the file specified in
2572 @code{tramp-persistency-file-name}. Keep this file.
2574 Disable version control. If you access remote files which are not
2575 under version control, a lot of check operations can be avoided by
2576 disabling VC. This can be achieved by
2579 (setq vc-handled-backends nil)
2582 Disable excessive traces. The default trace level of @value{tramp},
2583 defined in the variable @code{tramp-verbose}, is 3. You should
2584 increase this level only temporarily, hunting bugs.
2588 @value{tramp} does not connect to the remote host
2590 When @value{tramp} does not connect to the remote host, there are two
2591 reasons heading the bug mailing list:
2596 Unknown characters in the prompt
2598 @value{tramp} needs to recognize the prompt on the remote machine
2599 after execution any command. This is not possible, when the prompt
2600 contains unknown characters like escape sequences for coloring. This
2601 should be avoided on the remote side. @xref{Remote shell setup}. for
2602 setting the regular expression detecting the prompt.
2604 You can check your settings after an unsuccessful connection by
2605 switching to the @value{tramp} connection buffer @file{*tramp/foo*},
2606 setting the cursor at the top of the buffer, and applying the expression
2609 @kbd{M-: (re-search-forward (concat tramp-shell-prompt-pattern "$"))}
2612 If it fails, or the cursor is not moved at the end of the buffer, your
2613 prompt is not recognised correctly.
2615 A special problem is the zsh, which uses left-hand side and right-hand
2616 side prompts in parallel. Therefore, it is necessary to disable the
2617 zsh line editor on the remote host. You shall add to @file{~/.zshrc}
2618 the following command:
2621 [ $TERM = "dumb" ] && unsetopt zle && PS1='$ '
2626 @value{tramp} doesn't transfer strings with more than 500 characters
2629 On some few systems, the implementation of @code{process-send-string}
2630 seems to be broken for longer strings. It is reported for HP-UX,
2631 FreeBSD and Tru64 Unix, for example. This case, you should customize
2632 the variable @code{tramp-chunksize} to 500. For a description how to
2633 determine whether this is necessary see the documentation of
2634 @code{tramp-chunksize}.
2636 Additionally, it will be useful to set @code{file-precious-flag} to
2637 @code{t} for @value{tramp} files. Then the file contents will be
2638 written into a temporary file first, which is checked for correct
2641 @pxref{Saving Buffers, , , elisp}
2648 (when (file-remote-p default-directory)
2649 (set (make-local-variable 'file-precious-flag) t))))
2656 File name completion does not work with @value{tramp}
2658 When you log in to the remote machine, do you see the output of
2659 @command{ls} in color? If so, this may be the cause of your problems.
2661 @command{ls} outputs @acronym{ANSI} escape sequences that your terminal
2662 emulator interprets to set the colors. These escape sequences will
2663 confuse @value{tramp} however.
2665 In your @file{.bashrc}, @file{.profile} or equivalent on the remote
2666 machine you probably have an alias configured that adds the option
2667 @option{--color=yes} or @option{--color=auto}.
2669 You should remove that alias and ensure that a new login @emph{does not}
2670 display the output of @command{ls} in color. If you still cannot use
2671 filename completion, report a bug to the @value{tramp} developers.
2675 File name completion does not work in large directories
2677 @value{tramp} uses globbing for some operations. (Globbing means to use the
2678 shell to expand wildcards such as `*.c'.) This might create long
2679 command lines, especially in directories with many files. Some shells
2680 choke on long command lines, or don't cope well with the globbing
2683 If you have a large directory on the remote end, you may wish to execute
2684 a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
2685 Note that you must first start the right shell, which might be
2686 @command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
2687 of those supports tilde expansion.
2691 How can I get notified when @value{tramp} file transfers are complete?
2693 The following snippet can be put in your @file{~/.emacs} file. It
2694 makes @value{emacsname} beep after reading from or writing to the
2698 (defadvice tramp-handle-write-region
2699 (after tramp-write-beep-advice activate)
2700 "Make tramp beep after writing a file."
2704 (defadvice tramp-handle-do-copy-or-rename-file
2705 (after tramp-copy-beep-advice activate)
2706 "Make tramp beep after copying a file."
2710 (defadvice tramp-handle-insert-file-contents
2711 (after tramp-insert-beep-advice activate)
2712 "Make tramp beep after inserting a file."
2720 I'ld like to get a Visual Warning when working in a sudo:ed context
2722 When you are working with @samp{root} privileges, it might be useful
2723 to get an indication in the buffer's modeline. The following code,
2724 tested with @value{emacsname} 22.1, does the job. You should put it
2725 into your @file{~/.emacs}:
2728 (defun my-mode-line-function ()
2729 (when (string-match "^/su\\(do\\)?:" default-directory)
2730 (setq mode-line-format
2731 (format-mode-line mode-line-format 'font-lock-warning-face))))
2733 (add-hook 'find-file-hooks 'my-mode-line-function)
2734 (add-hook 'dired-mode-hook 'my-mode-line-function)
2741 I'ld like to see a host indication in the mode line when I'm remote
2743 The following code has been tested with @value{emacsname} 22.1. You
2744 should put it into your @file{~/.emacs}:
2747 (defconst my-mode-line-buffer-identification
2751 (if (file-remote-p default-directory)
2752 (tramp-file-name-host
2753 (tramp-dissect-file-name default-directory))
2755 (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name)
2756 (substring host-name 0 (match-beginning 1))
2761 mode-line-buffer-identification
2762 my-mode-line-buffer-identification)
2768 mode-line-buffer-identification
2769 my-mode-line-buffer-identification)))
2772 Since @value{emacsname} 23.1, the mode line contains an indication if
2773 @code{default-directory} for the current buffer is on a remote host.
2774 The corresponding tooltip includes the name of that host. If you
2775 still want the host name as part of the mode line, you can use the
2776 example above, but the @code{:eval} clause can be simplified:
2781 (or (file-remote-p default-directory 'host)
2783 (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name)
2784 (substring host-name 0 (match-beginning 1))
2792 My remote host does not understand default directory listing options
2794 @value{emacsname} computes the @command{dired} options depending on
2795 the local host you are working. If your @command{ls} command on the
2796 remote host does not understand those options, you can change them
2801 'dired-before-readin-hook
2803 (when (file-remote-p default-directory)
2804 (setq dired-actual-switches "-al"))))
2810 There's this @file{~/.sh_history} file on the remote host which keeps
2811 growing and growing. What's that?
2813 Sometimes, @value{tramp} starts @command{ksh} on the remote host for
2814 tilde expansion. Maybe @command{ksh} saves the history by default.
2815 @value{tramp} tries to turn off saving the history, but maybe you have
2816 to help. For example, you could put this in your @file{.kshrc}:
2819 if [ -f $HOME/.sh_history ] ; then
2820 /bin/rm $HOME/.sh_history
2822 if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
2825 if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
2831 @item There are longish file names to type. How to shorten this?
2833 Let's say you need regularly access to @file{@trampfn{ssh, news,
2834 news.my.domain, /opt/news/etc}}, which is boring to type again and
2835 again. The following approaches can be mixed:
2839 @item Use default values for method and user name:
2841 You can define default methods and user names for hosts,
2842 (@pxref{Default Method}, @pxref{Default User}):
2845 (setq tramp-default-method "ssh"
2846 tramp-default-user "news")
2849 The file name left to type would be
2850 @kbd{C-x C-f @trampfn{, , news.my.domain, /opt/news/etc}}.
2852 Note, that there are some useful settings already. Accessing your
2853 local host as @samp{root} user, is possible just by @kbd{C-x C-f
2856 @item Use configuration possibilities of your method:
2858 Several connection methods (i.e. the programs used) offer powerful
2859 configuration possibilities (@pxref{Customizing Completion}). In the
2860 given case, this could be @file{~/.ssh/config}:
2864 HostName news.my.domain
2868 The file name left to type would be @kbd{C-x C-f @trampfn{ssh, , xy,
2869 /opt/news/etc}}. Depending on files in your directories, it is even
2870 possible to complete the host name with @kbd{C-x C-f
2871 @value{prefix}ssh@value{postfixhop}x @key{TAB}}.
2873 @item Use environment variables:
2875 File names typed in the minibuffer can be expanded by environment
2876 variables. You can set them outside @value{emacsname}, or even with
2880 (setenv "xy" "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")
2883 Then you need simply to type @kbd{C-x C-f $xy @key{RET}}, and here you
2884 are. The disadvantage is, that you cannot edit the file name, because
2885 environment variables are not expanded during editing in the
2888 @item Define own keys:
2890 You can define your own key sequences in @value{emacsname}, which can
2891 be used instead of @kbd{C-x C-f}:
2895 [(control x) (control y)]
2901 "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))))
2904 Simply typing @kbd{C-x C-y} would initialize the minibuffer for
2905 editing with your beloved file name.
2907 See also @uref{http://www.emacswiki.org/cgi-bin/wiki/TrampMode, the
2908 Emacs Wiki} for a more comprehensive example.
2910 @item Define own abbreviation (1):
2912 It is possible to define an own abbreviation list for expanding file
2917 'directory-abbrev-alist
2918 '("^/xy" . "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))
2921 This shortens the file openening command to @kbd{C-x C-f /xy
2922 @key{RET}}. The disadvantage is, again, that you cannot edit the file
2923 name, because the expansion happens after entering the file name only.
2925 @item Define own abbreviation (2):
2927 The @code{abbrev-mode} gives more flexibility for editing the
2931 (define-abbrev-table 'my-tramp-abbrev-table
2932 '(("xy" "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")))
2935 'minibuffer-setup-hook
2938 (setq local-abbrev-table my-tramp-abbrev-table)))
2940 (defadvice minibuffer-complete
2941 (before my-minibuffer-complete activate)
2944 ;; If you use partial-completion-mode
2945 (defadvice PC-do-completion
2946 (before my-PC-do-completion activate)
2950 After entering @kbd{C-x C-f xy @key{TAB}}, the minibuffer is
2951 expanded, and you can continue editing.
2953 @item Use bookmarks:
2955 Bookmarks can be used to visit Tramp files or directories.
2957 @pxref{Bookmarks, , , @value{emacsdir}}
2960 When you have opened @file{@trampfn{ssh, news, news.my.domain,
2961 /opt/news/etc/}}, you should save the bookmark via
2963 @kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{set}}.
2966 @kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{set}}.
2969 Later on, you can always navigate to that bookmark via
2971 @kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{jump}}.
2974 @kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{jump}}.
2977 @item Use recent files:
2985 remembers visited places.
2988 @pxref{File Conveniences, , , @value{emacsdir}}
2991 @pxref{recent-files, , , edit-utils}
2995 You could keep remote file names in the recent list without checking
2996 their readability through a remote access:
3003 (recent-files-initialize)
3007 (when (file-remote-p (buffer-file-name))
3008 (recent-files-make-permanent)))
3013 The list of files opened recently is reachable via
3015 @kbd{@key{menu-bar} @key{file} @key{Open Recent}}.
3018 @kbd{@key{menu-bar} @key{Recent Files}}.
3022 @item Use filecache:
3024 @file{filecache} remembers visited places. Add the directory into
3028 (eval-after-load "filecache"
3029 '(file-cache-add-directory
3030 "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))
3033 Whenever you want to load a file, you can enter @kbd{C-x C-f
3034 C-@key{TAB}} in the minibuffer. The completion is done for the given
3041 @file{bbdb} has a built-in feature for @value{ftppackagename} files,
3042 which works also for @value{tramp}.
3044 @pxref{bbdb-ftp, Storing FTP sites in the BBDB, , bbdb}
3047 You need to load @file{bbdb}:
3054 Then you can create a BBDB entry via @kbd{M-x bbdb-create-ftp-site}.
3055 Because BBDB is not prepared for @value{tramp} syntax, you must
3056 specify a method together with the user name, when needed. Example:
3059 @kbd{M-x bbdb-create-ftp-site @key{RET}}
3060 @b{Ftp Site:} news.my.domain @key{RET}
3061 @b{Ftp Directory:} /opt/news/etc/ @key{RET}
3062 @b{Ftp Username:} ssh@value{postfixhop}news @key{RET}
3063 @b{Company:} @key{RET}
3064 @b{Additional Comments:} @key{RET}
3067 When you have opened your BBDB buffer, you can access such an entry by
3068 pressing the key @key{F}.
3073 I would like to thank all @value{tramp} users, who have contributed to
3074 the different recipes!
3078 How can I disable @value{tramp}?
3080 Shame on you, why did you read until now?
3086 If you just want to have @value{ftppackagename} as default remote
3087 files access package, you should apply the following code:
3090 (setq tramp-default-method "ftp")
3097 @value{tramp} (and @value{ftppackagename}),
3102 you must set @code{tramp-mode} to @code{nil}:
3105 (setq tramp-mode nil)
3109 Unloading @value{tramp} can be achieved by applying @kbd{M-x
3110 tramp-unload-tramp}.
3112 This resets also the @value{ftppackagename} plugins.
3118 @c For the developer
3119 @node Version Control
3120 @chapter The inner workings of remote version control
3121 @cindex Version Control
3123 Unlike @value{ftppackagename}, @value{tramp} has full shell access to the
3124 remote machine. This makes it possible to provide version control for
3125 files accessed under @value{tramp}.
3127 The actual version control binaries must be installed on the remote
3128 machine, accessible in the directories specified in
3129 @code{tramp-remote-path}.
3131 This transparent integration with the version control systems is one of
3132 the most valuable features provided by @value{tramp}, but it is far from perfect.
3133 Work is ongoing to improve the transparency of the system.
3136 * Version Controlled Files:: Determining if a file is under version control.
3137 * Remote Commands:: Executing the version control commands on the remote machine.
3138 * Changed workfiles:: Detecting if the working file has changed.
3139 * Checking out files:: Bringing the workfile out of the repository.
3140 * Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
3144 @node Version Controlled Files
3145 @section Determining if a file is under version control
3147 The VC package uses the existence of on-disk revision control master
3148 files to determine if a given file is under revision control. These file
3149 tests happen on the remote machine through the standard @value{tramp} mechanisms.
3152 @node Remote Commands
3153 @section Executing the version control commands on the remote machine
3155 There are no hooks provided by VC to allow intercepting of the version
3156 control command execution. The calls occur through the
3157 @code{call-process} mechanism, a function that is somewhat more
3158 efficient than the @code{shell-command} function but that does not
3159 provide hooks for remote execution of commands.
3161 To work around this, the functions @code{vc-do-command} and
3162 @code{vc-simple-command} have been advised to intercept requests for
3163 operations on files accessed via @value{tramp}.
3165 In the case of a remote file, the @code{shell-command} interface is
3166 used, with some wrapper code, to provide the same functionality on the
3167 remote machine as would be seen on the local machine.
3170 @node Changed workfiles
3171 @section Detecting if the working file has changed
3173 As there is currently no way to get access to the mtime of a file on a
3174 remote machine in a portable way, the @code{vc-workfile-unchanged-p}
3175 function is advised to call an @value{tramp} specific function for remote files.
3177 The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
3178 diff functionality to determine if any changes have occurred between the
3179 workfile and the version control master.
3181 This requires that a shell command be executed remotely, a process that
3182 is notably heavier-weight than the mtime comparison used for local
3183 files. Unfortunately, unless a portable solution to the issue is found,
3184 this will remain the cost of remote version control.
3187 @node Checking out files
3188 @section Bringing the workfile out of the repository
3190 VC will, by default, check for remote files and refuse to act on them
3191 when checking out files from the repository. To work around this
3192 problem, the function @code{vc-checkout} knows about @value{tramp} files and
3193 allows version control to occur.
3196 @node Miscellaneous Version Control
3197 @section Things related to Version Control that don't fit elsewhere
3199 Minor implementation details, &c.
3202 * Remote File Ownership:: How VC determines who owns a workfile.
3203 * Back-end Versions:: How VC determines what release your RCS is.
3207 @node Remote File Ownership
3208 @subsection How VC determines who owns a workfile
3210 @value{emacsname} provides the @code{user-login-name} function to
3211 return the login name of the current user as well as mapping from
3212 arbitrary user id values back to login names. The VC code uses this
3213 functionality to map from the uid of the owner of a workfile to the
3214 login name in some circumstances.
3216 This will not, for obvious reasons, work if the remote system has a
3217 different set of logins. As such, it is necessary to delegate to the
3218 remote machine the job of determining the login name associated with a
3221 Unfortunately, with the profusion of distributed management systems such
3222 as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
3223 reliable and portable method for performing this mapping.
3225 Thankfully, the only place in the VC code that depends on the mapping of
3226 a uid to a login name is the @code{vc-file-owner} function. This returns
3227 the login of the owner of the file as a string.
3229 This function has been advised to use the output of @command{ls} on the
3230 remote machine to determine the login name, delegating the problem of
3231 mapping the uid to the login to the remote system which should know more
3235 @node Back-end Versions
3236 @subsection How VC determines what release your RCS is
3238 VC needs to know what release your revision control binaries you are
3239 running as not all features VC supports are available with older
3240 versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.
3242 The default implementation of VC determines this value the first time it
3243 is needed and then stores the value globally to avoid the overhead of
3244 executing a process and parsing its output each time the information is
3247 Unfortunately, life is not quite so easy when remote version control
3248 comes into the picture. Each remote machine may have a different version
3249 of the version control tools and, while this is painful, we need to
3250 ensure that unavailable features are not used remotely.
3252 To resolve this issue, @value{tramp} currently takes the sledgehammer
3253 approach of making the release values of the revision control tools
3254 local to each @value{tramp} buffer, forcing VC to determine these values
3255 again each time a new file is visited.
3257 This has, quite obviously, some performance implications. Thankfully,
3258 most of the common operations performed by VC do not actually require
3259 that the remote version be known. This makes the problem far less
3262 Eventually these values will be captured by @value{tramp} on a system by
3263 system basis and the results cached to improve performance.
3266 @node Files directories and localnames
3267 @chapter How file names, directories and localnames are mangled and managed.
3270 * Localname deconstruction:: Breaking a localname into its components.
3272 * External packages:: Integration with external Lisp packages.
3277 @node Localname deconstruction
3278 @section Breaking a localname into its components.
3280 @value{tramp} file names are somewhat different, obviously, to ordinary file
3281 names. As such, the lisp functions @code{file-name-directory} and
3282 @code{file-name-nondirectory} are overridden within the @value{tramp}
3285 Their replacements are reasonably simplistic in their approach. They
3286 dissect the filename, call the original handler on the localname and
3287 then rebuild the @value{tramp} file name with the result.
3289 This allows the platform specific hacks in the original handlers to take
3290 effect while preserving the @value{tramp} file name information.
3294 @node External packages
3295 @section Integration with external Lisp packages.
3297 While reading filenames in the minibuffer, @value{tramp} must decide
3298 whether it completes possible incomplete filenames, or not. Imagine
3299 there is the following situation: You have typed @kbd{C-x C-f
3300 @value{prefix}ssh@value{postfixhop} @key{TAB}}. @value{tramp} cannot
3301 know, whether @option{ssh} is a method or a host name. It checks
3302 therefore the last input character you have typed. If this is
3303 @key{TAB}, @key{SPACE} or @kbd{?}, @value{tramp} assumes that you are
3304 still in filename completion, and it does not connect to the possible
3305 remote host @option{ssh}.
3307 @vindex tramp-completion-mode
3308 External packages, which use other characters for completing filenames
3309 in the minibuffer, must signal this to @value{tramp}. For this case,
3310 the variable @code{tramp-completion-mode} can be bound temporarily to
3314 (let ((tramp-completion-mode t))
3320 @node Traces and Profiles
3321 @chapter How to Customize Traces
3323 All @value{tramp} messages are raised with a verbosity level. The
3324 verbosity level can be any number between 0 and 10. Only messages with
3325 a verbosity level less than or equal to @code{tramp-verbose} are
3328 The verbosity levels are
3330 @w{ 0} silent (no @value{tramp} messages at all)
3331 @*@indent @w{ 1} errors
3332 @*@indent @w{ 2} warnings
3333 @*@indent @w{ 3} connection to remote hosts (default verbosity)
3334 @*@indent @w{ 4} activities
3335 @*@indent @w{ 5} internal
3336 @*@indent @w{ 6} sent and received strings
3337 @*@indent @w{ 7} file caching
3338 @*@indent @w{ 8} connection properties
3339 @*@indent @w{10} traces (huge)
3341 When @code{tramp-verbose} is greater than or equal to 4, the messages
3342 are also written into a @value{tramp} debug buffer. This debug buffer
3343 is useful for analysing problems; sending a @value{tramp} bug report
3344 should be done with @code{tramp-verbose} set to a verbosity level of at
3345 least 6 (@pxref{Bug Reports}).
3347 The debug buffer is in
3349 @ref{Outline Mode, , , @value{emacsdir}}.
3354 That means, you can change the level of messages to be viewed. If you
3355 want, for example, see only messages up to verbosity level 5, you must
3356 enter @kbd{C-u 6 C-c C-q}.
3358 Other keys for navigating are described in
3359 @ref{Outline Visibility, , , @value{emacsdir}}.
3362 @value{tramp} errors are handled internally in order to raise the
3363 verbosity level 1 messages. When you want to get a Lisp backtrace in
3364 case of an error, you need to set both
3367 (setq debug-on-error t
3371 Sometimes, it might be even necessary to step through @value{tramp}
3372 function call traces. Such traces are enabled by the following code:
3377 (dolist (elt (all-completions "tramp-" obarray 'functionp))
3378 (trace-function-background (intern elt)))
3379 (untrace-function 'tramp-read-passwd)
3380 (untrace-function 'tramp-gw-basic-authentication)
3383 The function call traces are inserted in the buffer
3384 @file{*trace-output*}. @code{tramp-read-passwd} and
3385 @code{tramp-gw-basic-authentication} shall be disabled when the
3386 function call traces are added to @value{tramp}, because both
3387 functions return password strings, which should not be distributed.
3391 @chapter Debatable Issues and What Was Decided
3394 @item The uuencode method does not always work.
3396 Due to the design of @value{tramp}, the encoding and decoding programs
3397 need to read from stdin and write to stdout. On some systems,
3398 @command{uudecode -o -} will read stdin and write the decoded file to
3399 stdout, on other systems @command{uudecode -p} does the same thing.
3400 But some systems have uudecode implementations which cannot do this at
3401 all---it is not possible to call these uudecode implementations with
3402 suitable parameters so that they write to stdout.
3404 Of course, this could be circumvented: the @code{begin foo 644} line
3405 could be rewritten to put in some temporary file name, then
3406 @command{uudecode} could be called, then the temp file could be
3407 printed and deleted.
3409 But I have decided that this is too fragile to reliably work, so on some
3410 systems you'll have to do without the uuencode methods.
3412 @item The @value{tramp} filename syntax differs between GNU Emacs and XEmacs.
3414 The GNU Emacs maintainers wish to use a unified filename syntax for
3415 Ange-FTP and @value{tramp} so that users don't have to learn a new
3416 syntax. It is sufficient to learn some extensions to the old syntax.
3418 For the XEmacs maintainers, the problems caused from using a unified
3419 filename syntax are greater than the gains. The XEmacs package system
3420 uses EFS for downloading new packages. So, obviously, EFS has to be
3421 installed from the start. If the filenames were unified, @value{tramp}
3422 would have to be installed from the start, too.
3425 @strong{Note:} If you'd like to use a similar syntax like
3426 @value{ftppackagename}, you need the following settings in your init
3430 (setq tramp-unified-filenames t)
3434 The autoload of the @value{emacsname} @value{tramp} package must be
3435 disabled. This can be achieved by setting file permissions @code{000}
3436 to the files @file{.../xemacs-packages/lisp/tramp/auto-autoloads.el*}.
3438 In case of unified filenames, all @value{emacsname} download sites are
3439 added to @code{tramp-default-method-alist} with default method
3440 @option{ftp} @xref{Default Method}. These settings shouldn't be
3441 touched for proper working of the @value{emacsname} package system.
3443 The syntax for unified filenames is described in the @value{tramp} manual
3444 for @value{emacsothername}.
3448 @node GNU Free Documentation License
3449 @appendix GNU Free Documentation License
3450 @include doclicense.texi
3452 @node Function Index
3453 @unnumbered Function Index
3456 @node Variable Index
3457 @unnumbered Variable Index
3461 @unnumbered Concept Index
3465 @c End of tramp.texi - the TRAMP User Manual
3470 @c * Say something about the .login and .profile files of the remote
3472 @c * Explain how tramp.el works in principle: open a shell on a remote
3473 @c host and then send commands to it.
3474 @c * Make terminology "inline" vs "out-of-band" consistent.
3475 @c It seems that "external" is also used instead of "out-of-band".
3478 @c ** Use `filename' resp. `file name' consistently.
3479 @c ** Use `host' resp. `machine' consistently.
3480 @c ** Consistent small or capitalized words especially in menues.
3483 arch-tag: f96dd66e-6dd3-4c92-8d77-9c56205ba808