(ibuffer-update): Call `minibufferp' with argument
[emacs.git] / man / tramp.texi
blobf2566590411033eb9243f58e01a9bd18737110d7
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename ../info/tramp
4 @settitle TRAMP User Manual
5 @setchapternewpage odd
6 @c %**end of header
8 @c This is *so* much nicer :)
9 @footnotestyle end
11 @c In the Tramp CVS, the version number is auto-frobbed from the
12 @c Makefile, so you should edit the top-level Makefile to change
13 @c the version number.
14 @macro trampver{}
15 2.0.22
16 @end macro
18 @c Entries for @command{install-info} to use
19 @dircategory Emacs
20 @direntry
21 * TRAMP: (tramp).                Transparent Remote Access, Multiple Protocol
22                                  Emacs remote file access via rsh and rcp.
23 @end direntry
25 @c Macro to make formatting of the tramp program name consistent.
26 @macro tramp
27 @sc{tramp}
28 @end macro
30 @c Distinguish between GNU Emacs and XEmacs.  Derived from the
31 @c Makefile variable $(EMACS-ID).  Valid values are `emacs' and `xemacs'.
32 @set emacs
34 @c Some flags which make the text independent on the (X)Emacs flavor.
35 @c GNU Emacs values.
36 @ifset emacs
37 @set emacs-name               Emacs
38 @set emacs-dir                emacs
39 @set ftp-package-name         Ange-FTP
40 @set tramp-prefix             /
41 @set tramp-prefix-single-hop
42 @set tramp-postfix            :
43 @set tramp-postfix-single-hop :
44 @set tramp-postfix-multi-hop  :
45 @end ifset
47 @c XEmacs counterparts.
48 @ifset xemacs
49 @set emacs-name               XEmacs
50 @set emacs-dir                xemacs
51 @set ftp-package-name         EFS
52 @set tramp-prefix             /[
53 @set tramp-prefix-single-hop  [
54 @set tramp-postfix            ]
55 @set tramp-postfix-single-hop /
56 @set tramp-postfix-multi-hop  :
57 @end ifset
59 @c Macros for formatting a filename.
60 @c trampfn is for a full filename, trampfnmhp means method, host, path
61 @c were given, and so on.
62 @macro trampfn(method, user, host, path)
63 @value{tramp-prefix}@value{method}@value{user}@@@value{host}@value{tramp-postfix}@value{path}
64 @end macro
66 @tex
68 @titlepage
69 @title @tramp{} version @trampver{} User Manual
71 @author by Daniel Pittman
72 @author based on documentation by Kai Gro@ss{}johann
73 @page
75 @end titlepage
76 @page
78 @end tex
80 @ifnottex
81 @node Top, Overview, (dir), (dir)
82 @top @tramp{} version @trampver{} User Manual
84 This file documents @tramp{} version @trampver{}, a remote file
85 editing package for @value{emacs-name}.
87 @tramp{} stands for `Transparent Remote (file) Access, Multiple
88 Protocol'.  This package provides remote file editing, similar to
89 @value{ftp-package-name}.
91 The difference is that @value{ftp-package-name} uses FTP to transfer
92 files between the local and the remote host, whereas @tramp{} uses a
93 combination of @command{rsh} and @command{rcp} or other work-alike
94 programs, such as @command{ssh}/@command{scp}.
96 You can find the latest version of this document on the web at
97 @uref{http://www.freesoftware.fsf.org/tramp/}.
99 @ifhtml
100 This manual is also available as a @uref{tramp_ja.html, Japanese
101 translation}.
103 The latest release of @tramp{} is available for
104 @uref{http://savannah.gnu.org/download/tramp/,
105 download}, or you may see @ref{Obtaining @tramp{}} for more details,
106 including the CVS server details.
108 @tramp{} also has a @uref{https://savannah.gnu.org/projects/tramp/,
109 Savannah Project Page}.
110 @end ifhtml
112 There is a mailing list for @tramp{}, available at
113 @email{tramp-devel@@mail.freesoftware.fsf.org}, and archived at
114 @uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/} as
115 well as the usual Savannah archives.
117 @end ifnottex
119 @menu
120 * Overview::                    What @tramp{} can and cannot do.
121 * Copying::                     The license for this documentation.
123 For the end user:
124 * Obtaining @tramp{}::          How to obtain @tramp{}.
125 * History::                     History of @tramp{}.
126 * Installation::                Installing @tramp{} with your @value{emacs-name}.
127 * Configuration::               Configuring @tramp{} for use.
128 * Usage::                       An overview of the operation of @tramp{}.
129 * Bug Reports::                 Reporting Bugs and Problems.
130 * Frequently Asked Questions::  Questions and answers from the mailing list.
132 For the developer:
133 * Version Control::             The inner workings of remote version control.
134 * Files directories and paths::  How file names, directories and paths are mangled and managed.
135 * Issues::                      Debatable Issues and What Was Decided.
137 @detailmenu
138  --- The Detailed Node Listing ---
140 Configuring @tramp{} for use
142 * Connection types::            Types of connections made to remote machines.
143 * Inline methods::              Inline methods.
144 * External transfer methods::   External transfer methods.
145 * Multi-hop Methods::           Connecting to a remote host using multiple hops.
146 * Default Method::              Selecting a default method.
147 * Customizing Methods::         Using Non-Standard Methods.
148 * Customizing Completion::      Selecting config files for user/host name completion.
149 * Remote Programs::             How @tramp{} finds and uses programs on the remote machine.
150 * Remote shell setup::          Remote shell setup hints.
151 * Windows setup hints::         Issues with Cygwin ssh.
153 Using @tramp
155 * Filename Syntax::             @tramp{} filename conventions.
156 * Multi-hop filename syntax::   Multi-hop filename conventions.
157 * Filename completion::         Filename completion.
158 * Dired::                       Dired.
160 The inner workings of remote version control
162 * Version Controlled Files::    Determining if a file is under version control.
163 * Remote Commands::             Executing the version control commands on the remote machine.
164 * Changed workfiles::           Detecting if the working file has changed.
165 * Checking out files::          Bringing the workfile out of the repository.
166 * Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
168 Things related to Version Control that don't fit elsewhere
170 * Remote File Ownership::       How VC determines who owns a workfile.
171 * Back-end Versions::           How VC determines what release your RCS is.
173 How file names, directories and paths are mangled and managed.
175 * Path deconstruction::         Breaking a path into its components.
177 @end detailmenu
178 @end menu
180 @node Overview
181 @chapter An overview of @tramp
182 @cindex overview
184 After the installation of @tramp{} into your @value{emacs-name}, you
185 will be able to access files on remote machines as though they were
186 local.  Access to the remote file system for editing files, version
187 control, and @command{dired} are transparently enabled.
189 Your access to the remote machine can be with the @command{rsh},
190 @command{rlogin}, @command{telnet} programs or with any similar
191 connection method.  This connection must pass ASCII successfully to be
192 usable but need not be 8-bit clean.
194 The package provides support for @command{ssh} connections out of the
195 box, one of the more common uses of the package.  This allows
196 relatively secure access to machines, especially if @command{ftp}
197 access is disabled.
199 The majority of activity carried out by @tramp{} requires only that
200 the remote login is possible and is carried out at the terminal.  In
201 order to access remote files @tramp{} needs to transfer their content
202 to the local machine temporarily.
204 @tramp{} can transfer files between the machines in a variety of ways.
205 The details are easy to select, depending on your needs and the
206 machines in question.
208 The fastest transfer methods (for large files) rely on a remote file
209 transfer package such as @command{rcp}, @command{scp} or
210 @command{rsync}.  The use of these methods is only possible if the
211 file copy command does not ask for a password for the remote machine.
213 If the remote copy methods are not suitable for you, @tramp{} also
214 supports the use of encoded transfers directly through the shell.
215 This requires that the @command{mimencode} or @command{uuencode} tools
216 are available on the remote machine.  These methods are generally
217 faster for small files.
219 Within these limitations, @tramp{} is quite powerful.  It is worth
220 noting that, as of the time of writing, it is far from a polished
221 end-user product.  For a while yet you should expect to run into rough
222 edges and problems with the code now and then.
224 It is finished enough that the developers use it for day to day work but
225 the installation and setup can be a little difficult to master, as can
226 the terminology.
228 @tramp{} is still under active development and any problems you encounter,
229 trivial or major, should be reported to the @tramp{} developers.
230 @xref{Bug Reports}.
233 @subsubheading Behind the scenes
234 @cindex behind the scenes
235 @cindex details of operation
236 @cindex how it works
238 This section tries to explain what goes on behind the scenes when you
239 access a remote file through @tramp{}.
241 Suppose you type @kbd{C-x C-f} and enter part of an @tramp{} file name,
242 then hit @kbd{@key{TAB}} for completion.  Suppose further that this is
243 the first time that @tramp{} is invoked for the host in question.  Here's
244 what happens:
246 @itemize
247 @item
248 @tramp{} discovers that it needs a connection to the host.  So it
249 invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
250 @var{user}} or a similar tool to connect to the remote host.
251 Communication with this process happens through an
252 @value{emacs-name} buffer, that is, the output from the remote end
253 goes into a buffer.
255 @item
256 The remote host may prompt for a login name (for @command{telnet}).  The
257 login name is given in the file name, so @tramp{} sends the login name and
258 a newline.
260 @item
261 The remote host may prompt for a password or pass phrase (for
262 @command{rsh} or for @command{telnet} after sending the login name).
263 @tramp{} displays the prompt in the minibuffer, asking you for the
264 password or pass phrase.
266 You enter the password or pass phrase.  @tramp{} sends it to the remote
267 host, followed by a newline.
269 @item
270 @tramp{} now waits for the shell prompt or for a message that the login
271 failed.
273 If @tramp{} sees neither of them after a certain period of time (a minute,
274 say), then it issues an error message saying that it couldn't find the
275 remote shell prompt and shows you what the remote host has sent.
277 If @tramp{} sees a @samp{login failed} message, it tells you so,
278 aborts the login attempt and allows you to try again.
280 @item
281 Suppose that the login was successful and @tramp{} sees the shell prompt
282 from the remote host.  Now @tramp{} invokes @command{/bin/sh} because
283 Bourne shells and C shells have different command
284 syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
285 shell doesn't recognize @samp{exec /bin/sh} as a valid command.
286 Maybe you use the Scheme shell @command{scsh}@dots{}}
288 After the Bourne shell has come up, @tramp{} sends a few commands to
289 ensure a good working environment.  It turns off echoing, it sets the
290 shell prompt, and a few other things.
292 @item
293 Now the remote shell is up and it good working order.  Remember, what
294 was supposed to happen is that @tramp{} tries to find out what files exist
295 on the remote host so that it can do filename completion.
297 So, @tramp{} basically issues @command{cd} and @command{ls} commands and
298 also sometimes @command{echo} with globbing.  Another command that is
299 often used is @command{test} to find out whether a file is writable or a
300 directory or the like.  The output of each command is parsed for the
301 necessary operation.
303 @item
304 Suppose you are finished with filename completion, have entered @kbd{C-x
305 C-f}, a full file name and hit @kbd{@key{RET}}.  Now comes the time to
306 transfer the file contents from the remote host to the local host so
307 that you can edit them.
309 See above for an explanation of how @tramp{} transfers the file contents.
311 For inline transfers, @tramp{} issues a command like @samp{mimencode -b
312 /path/to/remote/file}, waits until the output has accumulated in the
313 buffer that's used for communication, then decodes that output to
314 produce the file contents.
316 For out-of-band transfers, @tramp{} issues a command like the following:
317 @example
318 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
319 @end example
320 It then reads the local temporary file @file{/tmp/tramp.4711} into a
321 buffer and deletes the temporary file.
323 @item
324 You now edit the buffer contents, blithely unaware of what has happened
325 behind the scenes.  (Unless you have read this section, that is.)  When
326 you are finished, you type @kbd{C-x C-s} to save the buffer.
328 @item
329 Again, @tramp{} transfers the file contents to the remote host either
330 inline or out-of-band.  This is the reverse of what happens when reading
331 the file.
333 @end itemize
335 I hope this has provided you with a basic overview of what happens
336 behind the scenes when you open a file with @tramp{}.
339 @c Copying permissions, et al
340 @node Copying
341 @chapter Copying.
342 @cindex copying
344 @copying
345 Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software
346 Foundation, Inc.
348 @quotation     
349 Permission is granted to copy, distribute and/or modify this document
350 under the terms of the GNU Free Documentation License, Version 1.1 or
351 any later version published by the Free Software Foundation; with no
352 Invariant Sections, with the Front-Cover texts being ``A GNU
353 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
354 license is included in the section entitled ``GNU Free Documentation
355 License'' in the Emacs manual.
357 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
358 this GNU Manual, like GNU software.  Copies published by the Free
359 Software Foundation raise funds for GNU development.''
361 This document is part of a collection distributed under the GNU Free
362 Documentation License.  If you want to distribute this document
363 separately from the collection, you can do so by adding a copy of the
364 license to the document, as described in section 6 of the license.
365 @end quotation
366 @end copying
369 @c For the end user
370 @node Obtaining @tramp{}
371 @chapter Obtaining @tramp{}.
372 @cindex obtaining Tramp
374 @tramp{} is freely available on the Internet and the latest release may be
375 downloaded from
376 @uref{ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz}. This
377 release includes the full documentation and code for @tramp{}, suitable
378 for installation.  But Emacs (21.4 or later) includes @tramp{}
379 already, and there is a @tramp{} package for XEmacs, as well.  So
380 maybe it is easier to just use those.  But if you want the bleeding
381 edge, read on@dots{...}
383 For the especially brave, @tramp{} is available from CVS.  The CVS version
384 is the latest version of the code and may contain incomplete features or
385 new issues. Use these versions at your own risk.
387 Instructions for obtaining the latest development version of @tramp{}
388 from CVS can be found by going to the Savannah project page at the
389 following URL and then clicking on the CVS link in the navigation bar at
390 the top.
392 @noindent
393 @uref{http://savannah.gnu.org/projects/tramp/}
395 @noindent
396 Or follow the example session below:
398 @example
399 ] @strong{cd ~/@value{emacs-dir}}
400 ] @strong{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp login}
402 (Logging in to anoncvs@@subversions.gnu.org)
403 CVS password: @strong{(just hit RET here)}
404 @dots{}
406 ] @strong{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp co tramp}
407 @end example
409 @noindent
410 You should now have a directory @file{~/@value{emacs-dir}/tramp} containing the latest
411 version of @tramp{}. You can fetch the latest updates from the repository
412 by issuing the command:
414 @example
415 ] @strong{cd ~/@value{emacs-dir}/tramp}
416 ] @strong{cvs update -d}
417 @end example
420 @node History
421 @chapter History of @tramp{}
422 @cindex history
423 @cindex development history
425 Development was started end of November 1998.  The package was called
426 @file{rssh.el}, back then.  It only provided one method to access a
427 file, using @command{ssh} to log in to a remote host and using
428 @command{scp} to transfer the file contents.  After a while, the name
429 was changed to @file{rcp.el}, and now it's @tramp{}.  Along the way,
430 many more methods for getting a remote shell and for transferring the
431 file contents were added.  Support for VC was added.
433 The most recent addition of major features were the multi-hop methods
434 added in April 2000 and the unification of @tramp{} and Ange-FTP
435 filenames in July 2002.
438 @node Installation
439 @chapter Installing @tramp{} into @value{emacs-name}.
440 @cindex installation
442 If you use the version that comes with your @value{emacs-name}, the
443 following information is not necessary.  Installing @tramp{} into your
444 @value{emacs-name} is a relatively easy process, at least compared
445 to rebuilding your machine from scratch. ;)
447 Seriously though, the installation should be a fairly simple matter.
449 The easiest way to proceed is as follows:
451 @itemize @bullet
452 @item
453 Choose a directory, say @file{~/@value{emacs-dir}/}.  Change into that directory and
454 unpack the tarball.  This will give you a directory
455 @file{~/@value{emacs-dir}/tramp/} which contains subdirectories @file{lisp} for the
456 Lisp code and @file{texi} for the documentation.
458 @item
459 Optionally byte-compile all files in the Lisp directory,
460 @file{~/@value{emacs-dir}/tramp/lisp/}, by issuing a command like the following from
461 the top level directory @file{~/@value{emacs-dir}/tramp/}:
463 @example
464 make EMACS=@value{emacs-dir} all
465 @end example
467 @item
468 NOTE: If you run into problems running the example @command{make}
469 command, don't dispare.  You can still byte compile the @file{*.el}
470 files by opening @value{emacs-name} in @command{dired} (@command{C-x
471 d}) mode, at @file{~/@value{emacs-dir}/tramp/lisp}.  Mark the lisp files with
472 @kbd{m}, then press @kbd{B} to byte compile your selections.
474 Something similar can be done to create the info manual.  Just change
475 to directory @file{~/@value{emacs-dir}/tramp/texi} and load the
476 @file{tramp.texi} file in @value{emacs-name}.  Then press @kbd{M-x
477 makeinfo-buffer @key{RET}} to generate @file{tramp.info}.
479 @item
480 Tell @value{emacs-name} about the new Lisp directory and the
481 @tramp{} package with the following lines in @file{~/.emacs}:
483 @lisp
484 (add-to-list 'load-path "~/@value{emacs-dir}/tramp/lisp/")
485 (require 'tramp)
486 @end lisp
488 @item
489 To be able to read the Info documentation, create a file
490 @file{~/@value{emacs-dir}/tramp/texi/dir} using the
491 @command{install-info} command, and add the directory to the search
492 path for Info.
494 NOTE:
495 On systems using the @cite{gnu} version of @command{install-info}, the
496 @command{install-info} syntax is very direct and simple.  One can
497 change to directory @file{~/@value{emacs-dir}/tramp/texi} and type:
499 @example
500 install-info tramp.info dir
501 @end example
503 and a @file{dir} file will be created with the @tramp{}
504 entry.  The info reader will know how to interpret it, but must
505 be told where to find it (see below).  If you want anything fancier
506 you'll need to look through @kbd{man install-info}.
508 Debian gnu/linux doesn't default to @cite{gnu} @command{install-info}
509 and uses its own version.  This version does not create a @file{dir}
510 file for you from scratch.  You must provide a skeleton @file{dir}
511 file it recognizes.  One can be found in a default installation of
512 @value{emacs-name} at @file{/usr/info/dir}.  Copy the top of this file
513 down to the first occurrence of @code{* Menu} including that line plus
514 one more blank line, to your working directory
515 @file{~/@value{emacs-dir}/tramp/texi}, or use the sample
516 @file{~/@value{emacs-dir}/tramp/texi/dir_sample}.
518 Once a @file{dir} file is in place, this command will make the entry:
520 @example
521 install-info --infodir=. tramp.info
522 @end example
524 If you want it in a specific category see @kbd{man install-info} for
525 further details.
527 If the environment variable @env{INFOPATH} is set, add the directory
528 @file{~/@value{emacs-dir}/tramp/texi/} to it.  Else, add the directory to
529 @ifset emacs
530 @code{Info-default-directory-list}, as follows:
532 @lisp
533 (add-to-list 'Info-default-directory-list "~/@value{emacs-dir}/tramp/texi/")
534 @end lisp
535 @end ifset
536 @ifset xemacs
537 @code{Info-directory-list}, as follows:
538 @lisp
539 (add-to-list 'Info-directory-list "~/@value{emacs-dir}/tramp/texi/")
540 @end lisp
541 @end ifset
543 @end itemize
545 @ifset xemacs
546 For @value{emacs-name}, the package @file{fsf-compat} must be installed.
547 For details on package installation, see @ref{Packages, , ,xemacs}.
548 @ifhtml
549 (If the previous link doesn't work, try the @value{emacs-name}
550 documentation at
551 @uref{http://www.xemacs.org/Documentation/packageGuide.html,the
552 @value{emacs-name} site}.)
553 @end ifhtml
554 @end ifset
556 @node Configuration
557 @chapter Configuring @tramp{} for use
558 @cindex configuration
560 @cindex default configuration
561 @tramp{} is (normally) fully functional when it is initially
562 installed.  It is initially configured to use the @command{ssh} program
563 to connect to the remote host and to use base-64 encoding (on the
564 remote host, via @command{mimencode}, and on the local host via the
565 built-in support for base-64 encoding in Emacs).
567 On some hosts, there are problems with opening a connection.  These are
568 related to the behavior of the remote shell.  See @xref{Remote shell
569 setup}, for details on this.
571 If you do not wish to use these commands to connect to the remote
572 host, you should change the default connection and transfer method
573 that @tramp uses.  There are several different methods that @tramp{}
574 can use to connect to remote machines and transfer files
575 (@pxref{Connection types}).
578 @menu
579 * Connection types::            Types of connections made to remote machines.
580 * Inline methods::              Inline methods.
581 * External transfer methods::   External transfer methods.
582 * Multi-hop Methods::           Connecting to a remote host using multiple hops.
583 * Default Method::              Selecting a default method.
584 * Customizing Methods::         Using Non-Standard Methods.
585 * Customizing Completion::      Selecting config files for user/host name completion.
586 * Remote Programs::             How @tramp{} finds and uses programs on the remote machine.
587 * Remote shell setup::          Remote shell setup hints.
588 * Windows setup hints::         Issues with Cygwin ssh.
589 @end menu
592 @node Connection types
593 @section Types of connections made to remote machines.
594 @cindex connection types, overview
596 There are two basic types of transfer methods, each with its own
597 advantages and limitations.  Both types of connection make use of a
598 remote shell access program such as @command{rsh}, @command{ssh} or
599 @command{telnet} to connect to the remote machine.
601 This connection is used to perform many of the operations that @tramp
602 requires to make the remote file system transparently accessible from
603 the local machine. It is only when visiting files that the methods
604 differ.
606 @cindex inline methods
607 @cindex external transfer methods
608 @cindex external methods
609 @cindex out-of-band methods
610 @cindex methods, inline
611 @cindex methods, external transfer
612 @cindex methods, out-of-band
613 Loading or saving a remote file requires that the content of the file
614 be transfered between the two machines. The content of the file can be
615 transfered over the same connection used to log in to the remote
616 machine or the file can be transfered through another connection using
617 a remote copy program such as @command{rcp}, @command{scp} or
618 @command{rsync}.  The former are called @dfn{inline methods}, the
619 latter are called @dfn{out-of-band methods} or @dfn{external transfer
620 methods} (@dfn{external methods} for short).
622 The performance of the external transfer methods is generally better
623 than that of the inline methods, at least for large files.  This is
624 caused by the need to encode and decode the data when transferring
625 inline.
627 The one exception to this rule are the @command{scp} based transfer
628 methods.  While these methods do see better performance when actually
629 transferring files, the overhead of the cryptographic negotiation at
630 startup may drown out the improvement in file transfer times.
632 External transfer methods do require that the remote copy command is not
633 interactive --- that is, the command does not prompt you for a password.
634 If you cannot perform remote copies without a password, you will need to
635 use an inline transfer method to work with @tramp{}.
637 @cindex multi-hop methods
638 @cindex methods, multi-hop
639 A variant of the inline methods are the @dfn{multi-hop methods}.
640 These methods allow you to connect a remote host using a number `hops',
641 each of which connects to a different host.  This is useful if you are
642 in a secured network where you need to go through a bastion host to
643 connect to the outside world.
646 @node Inline methods
647 @section Inline methods
648 @cindex inline methods
649 @cindex methods, inline
651 The inline methods in @tramp{} are quite powerful and can work in
652 situations where you cannot use an external transfer program to connect.
653 Inline methods are the only methods that work when connecting to the
654 remote machine via telnet.  (There are also strange inline methods which
655 allow you to transfer files between @emph{user identities} rather than
656 hosts, see below.)
658 These methods depend on the existence of a suitable encoding and
659 decoding command on remote machine.  Locally, @tramp{} may be able to use
660 features of Emacs to decode and encode the files or it may require
661 access to external commands to perform that task.
663 @cindex uuencode
664 @tramp{} supports the use of @command{uuencode} to transfer files.
665 This is @emph{not} recommended.  The @command{uuencode} and
666 @command{uudecode} commands are not well standardized and may not
667 function correctly or at all on some machines, notably AIX and IRIX.
668 These systems do not work with @command{uuencode} at all.  (But do see
669 the note about AIX in the documentation for @var{tramp-methods}.)
671 @cindex mimencode
672 @cindex base-64 encoding
673 In summary, if possible use the @command{mimencode} methods to transfer
674 the data base64 encoded. This has the advantage of using a built-in
675 command in every modern Emacs, improving performance.
677 @table @asis
678 @item @option{rm}  ---  @command{rsh} with @command{mimencode}
679 @cindex method rm
680 @cindex rm method
681 @cindex method using rsh (rm)
683 Connect to the remote host with @command{rsh} and use base64 encoding to
684 transfer files between the machines.
686 This requires the @command{mimencode} command that is part of the
687 @command{metamail} packages. This may not be installed on all remote
688 machines.
691 @item @option{sm}  ---  @command{ssh} with @command{mimencode}
692 @cindex method sm
693 @cindex sm method
694 @cindex method using ssh (sm)
695 @cindex ssh (with sm method)
696 @cindex mimencode (with sm method)
697 @cindex base-64 encoding (with sm method)
699 Connect to the remote host with @command{ssh} and use base64 encoding to
700 transfer files between the machines.
702 This is identical to the previous option except that the @command{ssh}
703 package is used, making the connection more secure.
705 There are also two variants, @option{sm1} and @option{sm2}, that call
706 @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
707 explicitly select whether you want to use the SSH protocol version 1
708 or 2 to connect to the remote host.  (You can also specify in
709 @file{~/.ssh/config}, the SSH configuration file, which protocol
710 should be used, and use the regular @option{sm} method.)
712 There are also two variants, @option{sm-ssh1} and @option{sm-ssh2}
713 that use the @command{ssh1} and @command{ssh2} commands explicitly. If
714 you don't know what these are, you do not need these options.
716 All the methods based on @command{ssh} have an additional kludgy
717 feature: you can specify a host name which looks like @file{host#42}
718 (the real host name, then a hash sign, then a port number).  This
719 means to connect to the given host but to also pass @code{-p 42} as
720 arguments to the @command{ssh} command.
723 @item @option{tm}  ---  @command{telnet} with @command{mimencode}
724 @cindex method tm
725 @cindex tm method
726 @cindex method using telnet (tm)
727 @cindex telnet (with tm method)
728 @cindex mimencode (with tm method)
729 @cindex base-64 encoding (with tm method)
731 Connect to the remote host with @command{telnet} and use base64 encoding
732 to transfer files between the machines.
734 This requires the @command{mimencode} command that is part of the
735 @command{metamail} packages.
738 @item @option{ru}  ---  @command{rsh} with @command{uuencode}
739 @cindex method ru
740 @cindex ru method
741 @cindex method using rsh
742 @cindex rsh (with ru method)
743 @cindex uuencode (with ru method)
745 Connect to the remote host with @command{rsh} and use the
746 @command{uuencode} and @command{uudecode} commands to transfer files
747 between the machines.
750 @item @option{su}  ---  @command{ssh} with @command{uuencode}
751 @cindex method su
752 @cindex su method
753 @cindex method using ssh (su)
754 @cindex ssh (with su method)
755 @cindex uuencode (with su method)
757 Connect to the remote host with @command{ssh} and use the
758 @command{uuencode} and @command{uudecode} commands to transfer files
759 between the machines.
761 As with the @command{ssh} and base64 option (@option{sm}) above, this
762 provides the @option{su1} and @option{su2} methods to explicitly
763 select an SSH protocol version, and the @option{su-ssh1} and
764 @option{su-ssh2} variants to call specific SSH binaries.
766 Note that this method does not invoke the @command{su} program, see
767 below for methods which use that.
769 This supports the @samp{-p} kludge.
772 @item @option{tu}  ---  @command{telnet} with @command{uuencode}
773 @cindex tu method
774 @cindex method tu
775 @cindex method using telnet (tu)
776 @cindex telnet (with tu method)
777 @cindex uuencode (with tu method)
779 Connect to the remote host with @command{telnet} and use the
780 @command{uuencode} and @command{uudecode} commands to transfer files
781 between the machines.
784 @item @option{sum} --- @command{su} with @command{mimencode}
785 @cindex method sum
786 @cindex sum method
787 @cindex method using su (sum)
788 @cindex su (with sum method)
789 @cindex mimencode (with sum method)
790 @cindex base-64 encoding (with sum method)
792 This method does not connect to a remote host at all, rather it uses the
793 @command{su} program to allow you to edit files as another user.  Uses
794 base64 encoding to transfer the file contents.
797 @item @option{suu} --- @command{su} with @command{uuencode}
798 @cindex method suu
799 @cindex suu method
800 @cindex method using su (suu)
801 @cindex su (with suu method)
802 @cindex uuencode (with suu method)
804 Like @option{sum}, this uses the @command{su} program to allow you to
805 edit files on the local host as another user.  Uses @command{uuencode}
806 and @command{uudecode} to transfer the file contents.
809 @item @option{sudm} --- @command{sudo} with @command{mimencode}
810 @cindex method sudm
811 @cindex sudm method
812 @cindex method using sudo (sudm)
813 @cindex sudo (with sudm method)
814 @cindex mimencode (with sudm method)
815 @cindex base-64 encoding (with sudm method)
817 This is similar to the @option{sum} method, but it uses @command{sudo}
818 rather than @command{su} to become a different user.
820 Note that @command{sudo} must be configured to allow you to start a
821 shell as the user.  It would be nice if it was sufficient if
822 @command{ls} and @command{mimencode} were allowed, but that is not easy
823 to implement, so I haven't got around to it, yet.
826 @item @option{sudu} --- @command{sudo} with @command{uuencode}
827 @cindex method sudu
828 @cindex sudu method
829 @cindex method using sudo (sudu)
830 @cindex sudo (with sudu method)
831 @cindex uuencode (with sudu method)
833 This is similar to the @option{suu} method, but it uses @command{sudo}
834 rather than @command{su} to become a different user.
837 @item @option{smx} --- @command{ssh} with @command{mimencode}
838 @cindex method smx
839 @cindex smx method
840 @cindex method using ssh (smx)
841 @cindex ssh (with smx method)
842 @cindex mimencode (with smx method)
843 @cindex base-64 encoding (with smx method)
844 @cindex Cygwin (with smx method)
846 As you expect, this is similar to @option{sm}, only a little
847 different.  Whereas @option{sm} opens a normal interactive shell on
848 the remote host, this option uses @samp{ssh -t -t @var{host} -l
849 @var{user} /bin/sh} to open a connection.  This is useful for users
850 where the normal login shell is set up to ask them a number of
851 questions when logging in.  This procedure avoids these questions, and
852 just gives @tramp{} a more-or-less `standard' login shell to work
853 with.
855 Note that this procedure does not eliminate questions asked by
856 @command{ssh} itself.  For example, @command{ssh} might ask ``Are you
857 sure you want to continue connecting?'' if the host key of the remote
858 host is not known.  Tramp does not know how to deal with such a
859 question (yet), therefore you will need to make sure that you can log
860 in without such questions.
862 This is also useful for Windows users where @command{ssh}, when
863 invoked from an Emacs buffer, tells them that it is not allocating a
864 pseudo tty.  When this happens, the login shell is wont to not print
865 any shell prompt, which confuses @tramp{} mightily.  For reasons
866 unknown, some Windows ports for @command{ssh} (maybe the Cygwin one)
867 require the doubled @samp{-t} option.
869 This supports the @samp{-p} kludge.
872 @item @option{km} --- @command{krlogin} with @command{mimencode}
873 @cindex method km
874 @cindex km method
875 @cindex krlogin (with km method)
876 @cindex Kerberos (with km method)
877 @cindex mimencode (with km method)
878 @cindex base-64 encoding (with km method)
880 This method is also similar to @option{sm}.  It only uses the
881 @command{krlogin -x} command to log in to the remote host.
884 @item @option{plinku} --- @command{plink} with @command{uuencode}
885 @cindex method plinku
886 @cindex plinku method
887 @cindex method using plink (plinku)
888 @cindex plink (with plinku method)
889 @cindex uuencode (with plinku method)
891 This method is mostly interesting for Windows users using the PuTTY
892 implementation of SSH.  It uses @samp{plink -ssh} to log in to the
893 remote host.
895 CCC: Do we have to connect to the remote host once from the command
896 line to accept the SSH key?  Maybe this can be made automatic?
898 CCC: Does @command{plink} support the @samp{-p} option?  Tramp
899 will support that, anyway.
901 @item @option{plinkm} --- @command{plink} with @command{mimencode}
902 @cindex method plinkm
903 @cindex plinkm method
904 @cindex method using plink (plinkm)
905 @cindex plink (with plinkm method)
906 @cindex mimencode (with plinkm method)
907 @cindex base-64 encoding (with plinkm method)
909 Like @option{plinku}, but uses base64 encoding instead of uu encoding.
911 @end table
915 @node External transfer methods
916 @section External transfer methods
917 @cindex methods, external transfer
918 @cindex methods, out-of-band
919 @cindex external transfer methods
920 @cindex out-of-band methods
922 The external transfer methods operate through multiple channels, using
923 the remote shell connection for many actions while delegating file
924 transfers to an external transfer utility.
926 This saves the overhead of encoding and decoding that multiplexing the
927 transfer through the one connection has with the inline methods.
929 If you want to use an external transfer method you @emph{must} be able
930 to execute the transfer utility to copy files to and from the remote
931 machine without any interaction.
933 @cindex ssh-agent
934 This means that you will need to use @command{ssh-agent} if you use the
935 @command{scp} program for transfers, or maybe your version of
936 @command{scp} accepts a password on the command line.@footnote{PuTTY's
937 @command{pscp} allows you to specify the password on the command line.}
938 If you use @command{rsync} via @command{ssh} then the same rule must
939 apply to that connection.
941 If you cannot get @command{scp} to run without asking for a password but
942 would still like to use @command{ssh} to secure your connection, have a
943 look at the @command{ssh} based inline methods.
946 @table @asis
947 @item @option{rcp}  ---  @command{rsh} and @command{rcp}
948 @cindex method rcp
949 @cindex rcp method
950 @cindex rcp (with rcp method)
951 @cindex rsh (with rcp method)
953 This method uses the @command{rsh} and @command{rcp} commands to connect
954 to the remote machine and transfer files. This is probably the fastest
955 connection method available.
958 @item @option{scp}  ---  @command{ssh} and @command{scp}
959 @cindex method scp
960 @cindex scp method
961 @cindex scp (with scp method)
962 @cindex ssh (with scp method)
964 Using @command{ssh} to connect to the remote host and @command{scp} to
965 transfer files between the machines is the best method for securely
966 connecting to a remote machine and accessing files.
968 The performance of this option is also quite good. It may be slower than
969 the inline methods when you often open and close small files however.
970 The cost of the cryptographic handshake at the start of an @command{scp}
971 session can begin to absorb the advantage that the lack of encoding and
972 decoding presents.
974 All the @command{ssh} based methods support the kludgy @samp{-p}
975 feature where you can specify a port number to connect to in the host
976 name.  For example, the host name @file{host#42} tells Tramp to
977 specify @samp{-p 42} in the argument list for @command{ssh}.
980 @item @option{rsync}  ---  @command{ssh} and @command{rsync}
981 @cindex method rsync
982 @cindex rsync method
983 @cindex rsync (with rsync method)
984 @cindex ssh (with rsync method)
986 Using the @command{ssh} command to connect securely to the remote
987 machine and the @command{rsync} command to transfer files is almost
988 identical to the @option{scp} method.
990 While @command{rsync} performs much better than @command{scp} when
991 transferring files that exist on both hosts, this advantage is lost if
992 the file exists only on one side of the connection.
994 The @command{rsync} based method may be considerably faster than the
995 @command{rcp} based methods when writing to the remote system. Reading
996 files to the local machine is no faster than with a direct copy. 
998 This method supports the @samp{-p} hack.
1001 @item @option{scpx} --- @command{ssh} and @command{scp}
1002 @cindex method scpx
1003 @cindex scpx method
1004 @cindex scp (with scpx method)
1005 @cindex ssh (with scpx method)
1006 @cindex Cygwin (with scpx method)
1008 As you expect, this is similar to @option{scp}, only a little
1009 different.  Whereas @option{scp} opens a normal interactive shell on
1010 the remote host, this option uses @samp{ssh -t -t @var{host} -l
1011 @var{user} /bin/sh} to open a connection.  This is useful for users
1012 where the normal login shell is set up to ask them a number of
1013 questions when logging in.  This procedure avoids these questions, and
1014 just gives @tramp{} a more-or-less `standard' login shell to work
1015 with.
1017 This is also useful for Windows users where @command{ssh}, when
1018 invoked from an Emacs buffer, tells them that it is not allocating a
1019 pseudo tty.  When this happens, the login shell is wont to not print
1020 any shell prompt, which confuses @tramp{} mightily.  Maybe this
1021 applies to the Cygwin port of SSH.
1023 This method supports the @samp{-p} hack.
1026 @item @option{pscp} --- @command{plink} and @command{pscp}
1027 @cindex method pscp
1028 @cindex pscp method
1029 @cindex pscp (with pscp method)
1030 @cindex plink (with pscp method)
1031 @cindex PuTTY (with pscp method)
1033 This method is similar to @option{scp}, but it uses the
1034 @command{plink} command to connect to the remote host, and it uses
1035 @command{pscp} for transferring the files.  These programs are part
1036 of PuTTY, an SSH implementation for Windows.
1038 CCC: Does @command{plink} support the @samp{-p} hack?
1041 @item @option{fcp} --- @command{fsh} and @command{fcp}
1042 @cindex method fcp
1043 @cindex fcp method
1044 @cindex fsh (with fcp method)
1045 @cindex fcp (with fcp method)
1047 This method is similar to @option{scp}, but it uses the @command{fsh}
1048 command to connect to the remote host, and it uses @command{fcp} for
1049 transferring the files.  @command{fsh/fcp} are a front-end for
1050 @command{ssh} which allow for reusing the same @command{ssh} session
1051 for submitting several commands.  This avoids the startup overhead of
1052 @command{scp} (which has to establish a secure connection whenever it
1053 is called).  Note, however, that you can also use one of the inline
1054 methods to achieve a similar effect.
1056 This method uses the command @samp{fsh @var{host} -l @var{user}
1057 /bin/sh -i} to establish the connection, it does not work to just say
1058 @command{fsh @var{host} -l @var{user}}.
1060 @cindex method fsh
1061 @cindex fsh method
1062 There is no inline method using @command{fsh} as the multiplexing
1063 provided by the program is not very useful in our context.  @tramp{}
1064 opens just one connection to the remote host and then keeps it open,
1065 anyway.
1067 @end table
1069 @node Multi-hop Methods
1070 @section Connecting to a remote host using multiple hops
1071 @cindex multi-hop methods
1072 @cindex methods, multi-hop
1074 Sometimes, the methods described before are not sufficient.  Sometimes,
1075 it is not possible to connect to a remote host using a simple command.
1076 For example, if you are in a secured network, you might have to log in
1077 to a `bastion host' first before you can connect to the outside world.
1078 Of course, the target host may also require a bastion host.  The format
1079 of multi-hop filenames is slightly different than the format of normal
1080 @tramp{} methods.
1082 A multi-hop file name specifies a method, a number of hops, and a path
1083 name on the remote system.  The method specifies how the file is
1084 transferred through the inline connection.  The following two multi-hop
1085 methods are available:
1087 @table @asis
1088 @item @option{multi} --- base64 encoding with @command{mimencode}
1089 @cindex method multi
1090 @cindex multi method
1091 @cindex mimencode (with multi method)
1092 @cindex base-64 encoding (with multi method)
1094 The file is transferred through the connection in base64 encoding.  Uses
1095 the @command{mimencode} program for doing encoding and decoding, but
1096 uses an Emacs internal implementation on the local host if available.
1098 @item @option{multiu} --- use commands @command{uuencode} and @command{uudecode}
1099 @cindex method multiu
1100 @cindex multiu method
1101 @cindex uuencode (with multiu method)
1103 The file is transferred through the connection in `uu' encoding.  Uses
1104 the @command{uuencode} and @command{uudecode} programs for encoding and
1105 decoding, but uses a Lisp implementation for decoding on the local host
1106 if available.
1108 @end table
1110 Each hop consists of a @dfn{hop method} specification, a user name and a
1111 host name.  The following hop methods are (currently) available:
1113 @table @option
1114 @item telnet
1115 @cindex hop method telnet
1116 @cindex telnet hop method
1118 Uses the well-known @command{telnet} program to connect to the host.
1119 Whereas user name and host name are supplied in the file name, the
1120 user is queried for the password.
1122 @item rsh
1123 @cindex hop method rsh
1124 @cindex rsh hop method
1126 This uses @command{rsh} to connect to the host.  You do not need to
1127 enter a password unless @command{rsh} explicitly asks for it.
1129 @item ssh
1130 @cindex hop method ssh
1131 @cindex ssh hop method
1133 This uses @command{ssh} to connect to the host.  You might have to enter
1134 a password or a pass phrase.
1136 @item su
1137 @cindex hop method su
1138 @cindex su hop method
1140 This method does not actually contact a different host, but it allows
1141 you to become a different user on the host you're currently on.  This
1142 might be useful if you want to edit files as root, but the remote host
1143 does not allow remote root logins.  In this case you can use
1144 @option{telnet}, @option{rsh} or @option{ssh} to connect to the
1145 remote host as a non-root user, then use an @option{su} hop to become
1146 root.  But @option{su} need not be the last hop in a sequence, you could
1147 also use it somewhere in the middle, if the need arises.
1149 Even though you @emph{must} specify both user and host with a
1150 @option{su} hop, the host name is ignored and only the user name is
1151 used.
1153 @item sudo
1154 @cindex hop method sudo
1155 @cindex sudo hop method
1157 This is similar to the @option{su} hop, except that it uses
1158 @command{sudo} rather than @command{su} to become a different user.
1160 @end table
1162 Some people might wish to use port forwarding with @command{ssh} or
1163 maybe they have to use a nonstandard port.  This can be accomplished
1164 by putting a stanza in @file{~/.ssh/config} for the account which
1165 specifies a different port number for a certain host name.  But it can
1166 also be accomplished within Tramp, by adding a multi-hop method.  For
1167 example:
1169 @lisp
1170 (add-to-list
1171  'tramp-multi-connection-function-alist
1172  '("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n"))
1173 @end lisp
1175 Now you can use an @code{sshf} hop which connects to port 4400 instead of
1176 the standard port.
1179 @node Default Method
1180 @section Selecting a default method
1181 @cindex default method
1183 @vindex tramp-default-method
1184 When you select an appropriate transfer method for your typical usage
1185 you should set the variable @var{tramp-default-method} to reflect that
1186 choice.  This variable controls which method will be used when a method
1187 is not specified in the @tramp{} file path.  For example:
1189 @lisp
1190 (setq tramp-default-method "scp")
1191 @end lisp
1193 @vindex tramp-default-method-alist
1194 You can also specify different methods for certain user/host
1195 combinations, via the variable @var{tramp-default-method-alist}.  For
1196 example, the following two lines specify to use the @option{sm}
1197 method for all user names matching @samp{john} and the @option{rsync}
1198 method for all host names matching @samp{lily}.  The third line
1199 specifies to use the @option{sum} method for the user @samp{root} on
1200 the machine @samp{localhost}.
1202 @lisp
1203 (add-to-list 'tramp-default-method-alist '("" "john" "sm"))
1204 (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1205 (add-to-list 'tramp-default-method-alist
1206              '("\\`root\\'" "\\`localhost\\'" "sum"))
1207 @end lisp
1209 @noindent
1210 See the documentation for the variable
1211 @var{tramp-default-method-alist} for more details.
1213 External transfer methods are normally preferable to inline transfer
1214 methods, giving better performance. They may not be useful if you use
1215 many remote machines where you cannot log in without a password.
1217 @xref{Inline methods}.
1218 @xref{External transfer methods}.
1219 @xref{Multi-hop Methods}.
1221 Another consideration with the selection of transfer methods is the
1222 environment you will use them in and, especially when used over the
1223 Internet, the security implications of your preferred method.
1225 The @command{rsh} and @command{telnet} methods send your password as
1226 plain text as you log in to the remote machine, as well as transferring
1227 the files in such a way that the content can easily be read from other
1228 machines.
1230 If you need to connect to remote systems that are accessible from the
1231 Internet, you should give serious thought to using @command{ssh} based
1232 methods to connect. These provide a much higher level of security,
1233 making it a non-trivial exercise for someone to obtain your password or
1234 read the content of the files you are editing.
1236 @node Customizing Methods
1237 @section Using Non-Standard Methods
1238 @cindex customizing methods
1239 @cindex using non-standard methods
1240 @cindex create your own methods
1242 There is a variable @code{tramp-methods} which you can change if the
1243 predefined methods don't seem right.
1245 For the time being, I'll refer you to the Lisp documentation of that
1246 variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1249 @node Customizing Completion
1250 @section Selecting config files for user/host name completion
1251 @cindex customizing completion
1252 @cindex selecting config files
1253 @vindex tramp-completion-function-alist
1255 The variable @code{tramp-completion-function-alist} is intended to
1256 customize, which files are taken into account for user and host name
1257 completion (@pxref{Filename completion}).  For every method, it keeps
1258 a set of configuration files, accompanied by a Lisp function able to
1259 parse that file.  Entries in @code{tramp-completion-function-alist}
1260 have the form (@var{method} @var{pair1} @var{pair2} ...).
1262 Each @var{pair} is composed of (@var{function} @var{file}).
1263 @var{function} is responsible to extract user names and host names
1264 from @var{file} for completion.  There are two functions which access
1265 this variable:
1267 @defun tramp-get-completion-function method
1268 This function returns the list of completion functions for @var{method}.
1270 Example:
1271 @example
1272 (tramp-get-completion-function "rsh")
1274      @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1275          (tramp-parse-rhosts "~/.rhosts"))
1276 @end example
1277 @end defun
1279 @defun tramp-set-completion-function method function-list
1280 This function sets @var{function-list} as list of completion functions
1281 for @var{method}. 
1283 Example:
1284 @example
1285 (tramp-set-completion-function "ssh"
1286  '((tramp-parse-shosts "/etc/ssh_known_hosts")
1287    (tramp-parse-shosts "~/.ssh/known_hosts")))
1289      @result{} ((tramp-parse-shosts "/etc/ssh_known_hosts")
1290          (tramp-parse-shosts "~/.ssh/known_hosts"))
1291 @end example
1292 @end defun
1294 The following predefined functions parsing configuration files exists:
1296 @table @asis
1297 @item @code{tramp-parse-rhosts}
1298 @findex tramp-parse-rhosts
1300 This function parses files which are syntactical equivalent to
1301 @file{~/.rhosts}.  It returns both host names and user names, if
1302 specified.
1304 @item @code{tramp-parse-shosts}
1305 @findex tramp-parse-shosts
1307 This function parses files which are syntactical equivalent to
1308 @file{/etc/ssh_known_hosts}.  Since there are no user names specified
1309 in such files, it can return host names only.
1311 @item @code{tramp-parse-hosts}
1312 @findex tramp-parse-hosts
1314 A function dedicated to @file{/etc/hosts} style files.  It returns
1315 host names only.
1317 @item @code{tramp-parse-passwd}
1318 @findex tramp-parse-passwd
1320 A function which parses @file{/etc/passwd} like files.  Obviously, it
1321 can return user names only.
1323 @item @code{tramp-parse-netrc}
1324 @findex tramp-parse-netrc
1326 Finally, a function which parses @file{~/.netrc} like files.
1327 @end table
1329 If you want to keep your own data in a file, with your own structure,
1330 you might provide such a function as well.  This function must meet
1331 the following conventions:
1333 @defun my-tramp-parse file
1334 @var{file} must be either a file name on your host, or @code{nil}. The
1335 function must return a list of (@var{user} @var{host}), which are
1336 taken as candidates for user and host name completion.
1338 Example:
1339 @example
1340 (my-tramp-parse "~/.my-tramp-hosts")
1342      @result{} ((nil "toto") ("daniel" "melancholia"))
1343 @end example
1344 @end defun
1347 @node Remote Programs
1348 @section How @tramp{} finds and uses programs on the remote machine.
1350 @tramp{} depends on a number of programs on the remote host in order to
1351 function, including @command{ls}, @command{test}, @command{find} and
1352 @command{cat}.
1354 In addition to these required tools, there are various tools that may be
1355 required based on the connection method. See @ref{Inline methods} and
1356 @ref{External transfer methods} for details on these.
1358 Certain other tools, such as @command{perl} (or @command{perl5}) and
1359 @command{grep} will be used if they can be found. When they are
1360 available, they are used to improve the performance and accuracy of
1361 remote file access.
1363 @vindex tramp-remote-path
1364 When @tramp{} connects to the remote machine, it searches for the
1365 programs that it can use. The variable @var{tramp-remote-path} controls
1366 the directories searched on the remote machine.
1368 By default, this is set to a reasonable set of defaults for most
1369 machines. It is possible, however, that your local (or remote ;) system
1370 administrator has put the tools you want in some obscure local
1371 directory.
1373 In this case, you can still use them with @tramp{}. You simply need to
1374 add code to your @file{.emacs} to add the directory to the remote path.
1375 This will then be searched by @tramp{} when you connect and the software
1376 found.
1378 To add a directory to the remote search path, you could use code such
1381 @lisp
1382 @i{;; We load @tramp{} to define the variable.}
1383 (require 'tramp)
1384 @i{;; We have @command{perl} in "/usr/local/perl/bin"}
1385 (add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1386 @end lisp
1389 @node Remote shell setup
1390 @comment  node-name,  next,  previous,  up
1391 @section Remote shell setup hints
1392 @cindex remote shell setup
1393 @cindex @file{.profile} file
1394 @cindex @file{.login} file
1395 @cindex shell init files
1397 As explained in the @ref{Overview} section, @tramp{} connects to the
1398 remote host and talks to the shell it finds there.  Of course, when you
1399 log in, the shell executes its init files.  Suppose your init file
1400 requires you to enter the birth date of your mother; clearly @tramp{}
1401 does not know this and hence fails to log you in to that host.
1403 There are different possible strategies for pursuing this problem.  One
1404 strategy is to enable @tramp{} to deal with all possible situations.
1405 This is a losing battle, since it is not possible to deal with
1406 @emph{all} situations.  The other strategy is to require you to set up
1407 the remote host such that it behaves like @tramp{} expect.  This might
1408 be inconvenient because you have to invest a lot of effort into shell
1409 setup before you can begin to use @tramp{}.
1411 The package, therefore, pursues a combined approach.  It tries to figure
1412 out some of the more common setups, and only requires you to avoid
1413 really exotic stuff.  For example, it looks through a list of
1414 directories to find some programs on the remote host.  And also, it
1415 knows that it is not obvious how to check whether a file exist, and
1416 therefore it tries different possibilities.  (On some hosts and shells,
1417 the command @code{test -e} does the trick, on some hosts the shell
1418 builtin doesn't work but the program @code{/usr/bin/test -e} or
1419 @code{/bin/test -e} works.  And on still other hosts, @code{ls -d} is
1420 the right way to do this.)
1422 Below you find a discussion of a few things that @tramp{} does not deal
1423 with, and that you therefore have to set up correctly.
1425 @table @asis
1426 @item @var{shell-prompt-pattern}
1427 @vindex shell-prompt-pattern
1429 After logging in to the remote host, @tramp{} has to wait for the remote
1430 shell startup to finish before it can send commands to the remote
1431 shell.  The strategy here is to wait for the shell prompt.  In order to
1432 recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1433 to be set correctly to recognize the shell prompt on the remote host.
1435 Note that Tramp requires the match for @code{shell-prompt-pattern} to
1436 be at the end of the buffer.  Many people have something like the
1437 following as the value for the variable: @code{"^[^>$][>$] *"}.  Now
1438 suppose your shell prompt is @code{a <b> c $ }.  In this case, Tramp
1439 recognizes the @code{>} character as the end of the prompt, but it is
1440 not at the end of the buffer.
1442 @item @var{tramp-shell-prompt-pattern}
1443 @vindex tramp-shell-prompt-pattern
1445 This regular expression is used by @tramp{} in the same way as
1446 @code{shell-prompt-pattern}, to match prompts from the remote shell.
1447 This second variable exists because the prompt from the remote shell
1448 might be different from the prompt from a local shell --- after all,
1449 the whole point of @tramp{} is to log in to remote hosts as a
1450 different user.  The default value of
1451 @code{tramp-shell-prompt-pattern} is the same as the default value of
1452 @code{shell-prompt-pattern}, which is reported to work well in many
1453 circumstances.
1455 @item @code{tset} and other questions
1456 @cindex Unix command tset
1457 @cindex tset Unix command
1459 Some people invoke the @code{tset} program from their shell startup
1460 scripts which asks the user about the terminal type of the shell.
1461 Maybe some shells ask other questions when they are started.  @tramp{}
1462 does not know how to answer these questions.  There are two approaches
1463 for dealing with this problem.  One approach is to take care that the
1464 shell does not ask any questions when invoked from @tramp{}.  You can
1465 do this by checking the @code{TERM} environment variable, it will be
1466 set to @code{dumb} when connecting.
1468 @vindex tramp-terminal-type
1469 The variable @code{tramp-terminal-type} can be used to change this value
1470 to @code{dumb}.
1472 The other approach is to teach @tramp{} about these questions.  See
1473 the variables @code{tramp-actions-before-shell} and
1474 @code{tramp-multi-actions} (for multi-hop connections).
1476 @end table
1479 @node Windows setup hints
1480 @section Issues with Cygwin ssh
1481 @cindex Cygwin, issues
1483 This section needs a lot of work!  Please help.
1485 @cindex method smx with Cygwin
1486 @cindex smx method with Cygwin
1487 If you use the Cygwin installation of ssh (you have to explicitly select
1488 it in the installer), then it should work out of the box to just select
1489 @code{smx} as the connection method.  You can find information about
1490 setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}.
1493 @node Usage
1494 @chapter Using @tramp
1495 @cindex using @tramp
1497 Once you have installed @tramp{} it will operate fairly transparently. You
1498 will be able to access files on any remote machine that you can log in
1499 to as though they were local.
1501 Files are specified to @tramp{} using a formalized syntax specifying the
1502 details of the system to connect to.  This is similar to the syntax used
1503 by the @value{ftp-package-name} package.
1505 @cindex type-ahead
1506 Something that might happen which surprises you is that Emacs
1507 remembers all your keystrokes, so if you see a password prompt from
1508 Emacs, say, and hit @kbd{@key{RET}} twice instead of once, then the
1509 second keystroke will be processed by Emacs after @tramp{} has done
1510 its thing.  Why, this type-ahead is normal behavior, you say.  Right
1511 you are, but be aware that opening a remote file might take quite a
1512 while, maybe half a minute when a connection needs to be opened.
1513 Maybe after half a minute you have already forgotten that you hit that
1514 key!
1516 @menu
1517 * Filename Syntax::             @tramp{} filename conventions.
1518 * Multi-hop filename syntax::   Multi-hop filename conventions.
1519 * Filename completion::         Filename completion.
1520 * Dired::                       Dired.
1521 @end menu
1524 @node Filename Syntax
1525 @section @tramp{} filename conventions
1526 @cindex filename syntax
1527 @cindex filename examples
1529 To access the file @var{path} on the remote machine @var{machine} you
1530 would specify the filename
1531 @file{@value{tramp-prefix}@var{machine}@value{tramp-postfix}@var{path}}.
1532 This will connect to @var{machine} and transfer the file using the
1533 default method.  @xref{Default Method}.
1535 Some examples of @tramp{} filenames are shown below.
1537 @table @file
1538 @item @value{tramp-prefix}melancholia@value{tramp-postfix}.emacs
1539 Edit the file @file{.emacs} in your home directory on the machine
1540 @code{melancholia}.
1542 @item @value{tramp-prefix}melancholia.danann.net@value{tramp-postfix}.emacs
1543 This edits the same file, using the fully qualified domain name of
1544 the machine.
1546 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~/.emacs
1547 This also edits the same file --- the @file{~} is expanded to your
1548 home directory on the remote machine, just like it is locally.
1550 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~daniel/.emacs
1551 This edits the file @file{.emacs} in the home directory of the user
1552 @code{daniel} on the machine @code{melancholia}. The @file{~<user>}
1553 construct is expanded to the home directory of that user on the remote
1554 machine.
1556 @item @value{tramp-prefix}melancholia@value{tramp-postfix}/etc/squid.conf
1557 This edits the file @file{/etc/squid.conf} on the machine
1558 @code{melancholia}.
1560 @end table
1562 Unless you specify a different name to use, @tramp{} will use the
1563 current local user name as the remote user name to log in with. If you
1564 need to log in as a different user, you can specify the user name as
1565 part of the filename.
1567 To log in to the remote machine as a specific user, you use the syntax
1568 @file{@value{tramp-prefix}@var{user}@@@var{machine}@value{tramp-postfix}/@var{path/to.file}}.
1569 That means that connecting to @code{melancholia} as @code{daniel} and
1570 editing @file{.emacs} in your home directory you would specify
1571 @file{@value{tramp-prefix}daniel@@melancholia@value{tramp-postfix}.emacs}.
1573 It is also possible to specify other file transfer methods
1574 (@pxref{Default Method}) as part of the filename.
1575 @ifset emacs
1576 This is done by putting the method before the user and host name, as
1578 @file{@value{tramp-prefix}@var{method}@value{tramp-postfix-single-hop}}
1579 (note the trailing colon).
1580 @end ifset
1581 @ifset xemacs
1582 This is done by replacing the initial
1583 @file{@value{tramp-prefix}} with
1584 @file{@value{tramp-prefix}<method>@value{tramp-postfix-single-hop}}.
1585 (Note the trailing slash!).
1586 @end ifset
1587 The user, machine and file specification remain the same.
1589 So, to connect to the machine @code{melancholia} as @code{daniel},
1590 using the @option{su} method to transfer files, and edit @file{.emacs}
1591 in my home directory I would specify the filename
1592 @file{@value{tramp-prefix}su@value{tramp-postfix-single-hop}daniel@@melancholia@value{tramp-postfix}.emacs}.
1595 @node Multi-hop filename syntax
1596 @section Multi-hop filename conventions
1597 @cindex filename syntax for multi-hop files
1598 @cindex multi-hop filename syntax
1600 The syntax of multi-hop file names is necessarily slightly different
1601 than the syntax of other @tramp{} file names.  Here's an example
1602 multi-hop file name, first in Emacs syntax and then in XEmacs syntax:
1604 @example
1605 @value{tramp-prefix}multi@value{tramp-postfix-single-hop}rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host@value{tramp-postfix}/path/to.file
1606 @end example
1608 This is quite a mouthful.  So let's go through it step by step.  The
1609 file name consists of three parts.
1610 @ifset emacs
1611 The parts are separated by colons
1612 @end ifset
1613 @ifset xemacs
1614 The parts are separated by slashes and square brackets.
1615 @end ifset
1616 The first part is @file{@value{tramp-prefix}multi}, the method
1617 specification.  The second part is
1618 @file{rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host}
1619 and specifies the hops.  The final part is @file{/path/to.file} and
1620 specifies the file name on the remote host.
1622 The first part and the final part should be clear.  @ref{Multi-hop
1623 Methods}, for a list of alternatives for the method specification.
1625 The second part can be subdivided again into components, so-called
1626 hops.  In the above file name, there are two hops,
1627 @file{rsh@value{tramp-postfix-multi-hop}out@@gate} and
1628 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}.
1630 Each hop can @emph{again} be subdivided into (three) components, the
1631 @dfn{hop method}, the @dfn{user name} and the @dfn{host name}.  The
1632 meaning of the second and third component should be clear, and the hop
1633 method says what program to use to perform that hop.
1635 The first hop, @file{rsh@value{tramp-postfix-multi-hop}out@@gate},
1636 says to use @command{rsh} to log in as user @code{out} to the host
1637 @code{gate}.  Starting at that host, the second hop,
1638 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}, says to
1639 use @command{telnet} to log in as user @code{kai} to host
1640 @code{real.host}.
1642 @xref{Multi-hop Methods}, for a list of possible hop method values.
1643 The variable @code{tramp-multi-connection-function-alist} contains the
1644 list of possible hop methods and information on how to execute them,
1645 should you want to add your own.
1648 @node Filename completion
1649 @section Filename completion
1650 @cindex filename completion
1652 Filename completion works with @tramp{} for both completing methods,
1653 user names and machine names (except multi hop methods) as well as for
1654 files on remote machines.
1656 If you, for example, type @kbd{C-x C-f @value{tramp-prefix}t
1657 @key{TAB}}, @tramp{} might give you as result the choice for
1659 @example
1660 @ifset emacs
1661 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}                              tmp/
1662 @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1663 @end ifset
1664 @ifset xemacs
1665 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}                              @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1666 @end ifset
1667 @end example
1668      
1669 @samp{@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}}
1670 is a possible completion for the respective method,
1671 @ifset emacs
1672 @samp{tmp/} stands for the directory @file{/tmp} on your local
1673 machine,
1674 @end ifset
1675 and @samp{@value{tramp-prefix-single-hop}toto@value{tramp-postfix}}
1676 might be a host @tramp has detected in your @file{~/.ssh/known_hosts}
1677 file (given you're using default method @option{ssh}).
1679 If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
1680 @samp{@value{tramp-prefix}telnet@value{tramp-postfix-single-hop}}.
1681 Next @kbd{@key{TAB}} brings you all machine names @tramp{} detects in
1682 your @file{/etc/hosts} file, let's say
1684 @example
1685 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}127.0.0.1@value{tramp-postfix}                @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}192.168.0.1@value{tramp-postfix}
1686 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}localhost@value{tramp-postfix}                @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia.danann.net@value{tramp-postfix}
1687 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia@value{tramp-postfix}
1688 @end example
1690 Now you can choose the desired machine, and you can continue to
1691 complete file names on that machine.
1693 As filename completion needs to fetch the listing of files from the
1694 remote machine, this feature is sometimes fairly slow.  As @tramp{}
1695 does not yet cache the results of directory listing, there is no gain
1696 in performance the second time you complete filenames.
1698 If the configuration files (@pxref{Customizing Completion}), which
1699 @tramp{} uses for analysis of completion, offer user names, those user
1700 names will be taken into account as well.
1703 @node Dired
1704 @section Dired
1705 @cindex dired
1707 @tramp{} works transparently with dired, enabling you to use this powerful
1708 file management tool to manage files on any machine you have access to
1709 over the Internet.
1711 If you need to browse a directory tree, Dired is a better choice, at
1712 present, than filename completion.  Dired has its own cache mechanism
1713 and will only fetch the directory listing once.
1716 @node Bug Reports
1717 @chapter Reporting Bugs and Problems
1718 @cindex bug reports
1720 Bugs and problems with @tramp{} are actively worked on by the development
1721 team. Feature requests and suggestions are also more than welcome.
1723 The @tramp{} mailing list is a great place to get information on working
1724 with @tramp{}, solving problems and general discussion and advice on topics
1725 relating to the package.
1727 The  mailing list is at @email{tramp-devel@@mail.freesoftware.fsf.org}.
1728 Messages sent to this address go to all the subscribers. This is
1729 @emph{not} the address to send subscription requests to.
1731 For help on subscribing to the list, send mail to the administrative
1732 address, @email{tramp-devel-request@@mail.freesoftware.fsf.org}, with the
1733 subject @samp{help}.
1735 To report a bug in @tramp{}, you should execute @kbd{M-x tramp-bug}. This
1736 will automatically generate a buffer with the details of your system and
1737 @tramp{} version.
1739 When submitting a bug report, please try to describe in excruciating
1740 detail the steps required to reproduce the problem, the setup of the
1741 remote machine and any special conditions that exist.
1743 If you can identify a minimal test case that reproduces the problem,
1744 include that with your bug report. This will make it much easier for the
1745 development team to analyze and correct the problem.
1747 @node Frequently Asked Questions
1748 @chapter Frequently Asked Questions
1749 @cindex frequently asked questions
1750 @cindex FAQ
1752 @itemize @bullet
1753 @item
1754 Where can I get the latest @tramp{}?
1756 @tramp{} is available under the URL below.
1758 @noindent
1759 @uref{ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz}
1761 @noindent
1762 There is also a Savannah project page.
1764 @noindent
1765 @uref{https://savannah.gnu.org/projects/tramp/}
1767 @item
1768 Which systems does it work on?
1770 The package has been used successfully on Emacs 20 and Emacs 21, as well
1771 as XEmacs 21.  XEmacs 20 is more problematic, see the notes in
1772 @file{tramp.el}.  I don't think anybody has really tried it on Emacs 19.
1774 The package was intended to work on Unix, and it really expects a
1775 Unix-like system on the remote end, but some people seemed to have some
1776 success getting it to work on NT Emacs.
1778 There are some informations on Tramp on NT at the following URL; many
1779 thanks to Joe Stoy for providing the information:
1780 @uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}
1782 The above mostly contains patches to old ssh versions; Tom Roche has a
1783 Web page with instructions:
1784 @uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
1786 ??? Is the XEmacs info correct?
1788 ??? Can somebody provide some information for getting it to work on NT
1789 Emacs?  I think there was some issue with @command{ssh}?
1792 @item
1793 I can't stop EFS starting with XEmacs
1795 Not all the older versions of @tramp{} supported XEmacs correctly. The
1796 first thing to do is to make sure that you have the latest version of
1797 @tramp{} installed.
1799 If you do, please try and find out exactly the conditions required for
1800 the EFS handlers to fire. If you can, putting a breakpoint on
1801 @code{efs-ftp-path} and sending in the stack trace along with your bug
1802 report would make it easier for the developers to work out what is
1803 going wrong.
1806 @item
1807 File name completion does not work with @tramp{}
1809 When you log in to the remote machine, do you see the output of
1810 @command{ls} in color? If so, this may be the cause of your problems.
1812 @command{ls} outputs @acronym{ANSI} escape sequences that your terminal
1813 emulator interprets to set the colors. These escape sequences will
1814 confuse @tramp{} however.
1816 In your @file{.bashrc}, @file{.profile} or equivalent on the remote
1817 machine you probably have an alias configured that adds the option
1818 @option{--color=yes} or @option{--color=auto}.
1820 You should remove that alias and ensure that a new login @emph{does not}
1821 display the output of @command{ls} in color. If you still cannot use
1822 filename completion, report a bug to the @tramp{} developers.
1825 @item
1826 File name completion does not work in large directories
1828 @tramp{} uses globbing for some operations.  (Globbing means to use the
1829 shell to expand wildcards such as `*.c'.)  This might create long
1830 command lines, especially in directories with many files.  Some shell
1831 choke on long command lines, or don't cope well with the globbing
1832 itself.
1834 If you have a large directory on the remote end, you may wish to execute
1835 a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
1836 Note that you must first start the right shell, which might be
1837 @command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
1838 of those supports tilde expansion.
1841 @item
1842 What kinds of systems does @tramp{} work on
1844 @tramp{} really expects the remote system to be a Unix-like system.  The
1845 local system should preferably be Unix-like, as well, but @tramp{} might
1846 work on NT with some tweaking.
1849 @item
1850 How can I get notified when @tramp{} file transfers are complete?
1852 The following snippet can be put in your @file{~/.emacs} file.  It makes
1853 Emacs beep after reading from or writing to the remote host.
1855 @lisp
1856 (defadvice tramp-handle-write-region
1857   (after tramp-write-beep-advice activate)
1858  " make tramp beep after writing a file."
1859  (interactive)
1860  (beep))
1861 (defadvice tramp-handle-do-copy-or-rename-file
1862   (after tramp-copy-beep-advice activate)
1863  " make tramp beep after copying a file."
1864  (interactive)
1865  (beep))
1866 (defadvice tramp-handle-insert-file-contents
1867   (after tramp-copy-beep-advice activate)
1868  " make tramp beep after copying a file."
1869  (interactive)
1870  (beep))
1871 @end lisp
1874 @item
1875 There's this @file{~/.sh_history} file on the remote host which keeps
1876 growing and growing.  What's that?
1878 Sometimes, @tramp{} starts @code{ksh} on the remote host for tilde
1879 expansion.  Maybe @code{ksh} saves the history by default.  @tramp{}
1880 tries to turn off saving the history, but maybe you have to help.  For
1881 example, you could put this in your @file{.kshrc}:
1883 @example
1884 if [ -f $HOME/.sh_history ] ; then
1885    /bin/rm $HOME/.sh_history
1887 if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
1888    unset HISTFILE
1890 if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
1891    unset HISTSIZE
1893 @end example
1895 @end itemize
1898 @c For the developer
1899 @node Version Control
1900 @chapter The inner workings of remote version control
1902 Unlike @value{ftp-package-name}, @tramp{} has full shell access to the
1903 remote machine. This makes it possible to provide version control for
1904 files accessed under @tramp{}.
1906 The actual version control binaries must be installed on the remote
1907 machine, accessible in the directories specified in
1908 @var{tramp-remote-path}.
1910 This transparent integration with the version control systems is one of
1911 the most valuable features provided by @tramp{}, but it is far from perfect.
1912 Work is ongoing to improve the transparency of the system.
1914 @menu
1915 * Version Controlled Files::    Determining if a file is under version control.
1916 * Remote Commands::             Executing the version control commands on the remote machine.
1917 * Changed workfiles::           Detecting if the working file has changed.
1918 * Checking out files::          Bringing the workfile out of the repository.
1919 * Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
1920 @end menu
1923 @node Version Controlled Files
1924 @section Determining if a file is under version control
1926 The VC package uses the existence of on-disk revision control master
1927 files to determine if a given file is under revision control. These file
1928 tests happen on the remote machine through the standard @tramp{} mechanisms.
1931 @node Remote Commands
1932 @section Executing the version control commands on the remote machine
1934 There are no hooks provided by VC to allow intercepting of the version
1935 control command execution. The calls occur through the
1936 @code{call-process} mechanism, a function that is somewhat more
1937 efficient than the @code{shell-command} function but that does not
1938 provide hooks for remote execution of commands.
1940 To work around this, the functions @code{vc-do-command} and
1941 @code{vc-simple-command} have been advised to intercept requests for
1942 operations on files accessed via @tramp{}.
1944 In the case of a remote file, the @code{shell-command} interface is
1945 used, with some wrapper code, to provide the same functionality on the
1946 remote machine as would be seen on the local machine. 
1949 @node Changed workfiles
1950 @section Detecting if the working file has changed
1952 As there is currently no way to get access to the mtime of a file on a
1953 remote machine in a portable way, the @code{vc-workfile-unchanged-p}
1954 function is advised to call an @tramp{} specific function for remote files.
1956 The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
1957 diff functionality to determine if any changes have occurred between the
1958 workfile and the version control master.
1960 This requires that a shell command be executed remotely, a process that
1961 is notably heavier-weight than the mtime comparison used for local
1962 files. Unfortunately, unless a portable solution to the issue is found,
1963 this will remain the cost of remote version control.
1966 @node Checking out files
1967 @section Bringing the workfile out of the repository
1969 VC will, by default, check for remote files and refuse to act on them
1970 when checking out files from the repository. To work around this
1971 problem, the function @code{vc-checkout} knows about @tramp{} files and
1972 allows version control to occur.
1975 @node Miscellaneous Version Control
1976 @section Things related to Version Control that don't fit elsewhere
1978 Minor implementation details, &c.
1980 @menu
1981 * Remote File Ownership::       How VC determines who owns a workfile.
1982 * Back-end Versions::           How VC determines what release your RCS is.
1983 @end menu
1986 @node Remote File Ownership
1987 @subsection How VC determines who owns a workfile
1989 Emacs provides the @code{user-full-name} function to return the login name
1990 of the current user as well as mapping from arbitrary user id values
1991 back to login names. The VC code uses this functionality to map from the
1992 uid of the owner of a workfile to the login name in some circumstances.
1994 This will not, for obvious reasons, work if the remote system has a
1995 different set of logins. As such, it is necessary to delegate to the
1996 remote machine the job of determining the login name associated with a
1997 uid.
1999 Unfortunately, with the profusion of distributed management systems such
2000 as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
2001 reliable and portable method for performing this mapping.
2003 Thankfully, the only place in the VC code that depends on the mapping of
2004 a uid to a login name is the @code{vc-file-owner} function. This returns
2005 the login of the owner of the file as a string.
2007 This function has been advised to use the output of @command{ls} on the
2008 remote machine to determine the login name, delegating the problem of
2009 mapping the uid to the login to the remote system which should know more
2010 about it than I do.
2013 @node Back-end Versions
2014 @subsection How VC determines what release your RCS is
2016 VC needs to know what release your revision control binaries you are
2017 running as not all features VC supports are available with older
2018 versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.
2020 The default implementation of VC determines this value the first time it
2021 is needed and then stores the value globally to avoid the overhead of
2022 executing a process and parsing its output each time the information is
2023 needed.
2025 Unfortunately, life is not quite so easy when remote version control
2026 comes into the picture. Each remote machine may have a different version
2027 of the version control tools and, while this is painful, we need to
2028 ensure that unavailable features are not used remotely.
2030 To resolve this issue, @tramp{} currently takes the sledgehammer
2031 approach of making the release values of the revision control tools
2032 local to each @tramp{} buffer, forcing VC to determine these values
2033 again each time a new file is visited.
2035 This has, quite obviously, some performance implications. Thankfully,
2036 most of the common operations performed by VC do not actually require
2037 that the remote version be known. This makes the problem far less
2038 apparent.
2040 Eventually these values will be captured by @tramp{} on a system by
2041 system basis and the results cached to improve performance.
2044 @node Files directories and paths
2045 @chapter How file names, directories and paths are mangled and managed.
2047 @menu
2048 * Path deconstruction::         Breaking a path into its components.
2049 @end menu
2052 @node Path deconstruction
2053 @section Breaking a path into its components.
2055 @tramp{} filenames are somewhat different, obviously, to ordinary path
2056 names. As such, the lisp functions @code{file-name-directory} and
2057 @code{file-name-nondirectory} are overridden within the @tramp{} package.
2059 Their replacements are reasonably simplistic in their approach. They
2060 dissect the filename, call the original handler on the remote path and
2061 then rebuild the @tramp{} path with the result.
2063 This allows the platform specific hacks in the original handlers to take
2064 effect while preserving the @tramp{} path information.
2067 @node Issues
2068 @chapter Debatable Issues and What Was Decided
2070 @itemize @bullet
2071 @item The uuencode method does not always work.
2073 Due to the design of @tramp{}, the encoding and decoding programs need to
2074 read from stdin and write to stdout.  On some systems, @code{uudecode -o
2075 -} will read stdin and write the decoded file to stdout, on other
2076 systems @code{uudecode -p} does the same thing.  But some systems have
2077 uudecode implementations which cannot do this at all---it is not
2078 possible to call these uudecode implementations with suitable parameters
2079 so that they write to stdout.
2081 Of course, this could be circumvented: the @code{begin foo 644} line
2082 could be rewritten to put in some temporary file name, then
2083 @code{uudecode} could be called, then the temp file could be printed and
2084 deleted.
2086 But I have decided that this is too fragile to reliably work, so on some
2087 systems you'll have to do without the uuencode methods.
2089 @item @tramp{} does not work on XEmacs 20.
2091 This is because it requires the macro @code{with-timeout} which does not
2092 appear to exist in XEmacs 20.  I'm somewhat reluctant to add an
2093 emulation macro to @tramp{}, but if somebody who uses XEmacs 20 steps
2094 forward and wishes to implement and test it, please contact me or the
2095 mailing list.
2097 @item The @tramp{} filename syntax differs between Emacs and XEmacs.
2099 The Emacs maintainers wish to use a unified filename syntax for
2100 Ange-FTP and @tramp{} so that users don't have to learn a new
2101 syntax.  It is sufficient to learn some extensions to the old syntax.
2103 For the XEmacs maintainers, the problems caused from using a unified
2104 filename syntax are greater than the gains.  The XEmacs package
2105 system uses EFS for downloading new packages.  So, obviously, EFS has
2106 to be installed from the start.  If the filenames were unified, Tramp
2107 would have to be installed from the start, too.
2109 @end itemize
2112 @c End of tramp.texi - the TRAMP User Manual
2113 @bye
2115 @c TODO
2117 @c * Say something about the .login and .profile files of the remote
2118 @c   shells.
2119 @c * Explain how tramp.el works in principle: open a shell on a remote
2120 @c   host and then send commands to it.
2121 @c * Mention that bookmarks are a cool feature to go along with Tramp.
2122 @c * Make terminology "inline" vs "out-of-band" consistent.
2123 @c   It seems that "external" is also used instead of "out-of-band".
2125 @c * M. Albinus
2126 @c ** Use `filename' resp. `file name' consistently.
2127 @c ** Use `host' resp. `machine' consistently.
2128 @c ** Consistent small or capitalized words especially in menues.