(Top): Undo the previous renaming.
[emacs.git] / man / tramp.texi
blobe0ee4080fcfda257a217d4f449bf3943b474caf4
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
12 @c configure.ac, so you should edit that file and run
13 @c "autoconf && ./configure" to change the version number.
14 @include trampver.texi
16 @c Entries for @command{install-info} to use
17 @dircategory Emacs
18 @direntry
19 * TRAMP: (tramp).                Transparent Remote Access, Multiple Protocol
20                                  Emacs remote file access via rsh and rcp.
21 @end direntry
23 @c Macro to make formatting of the tramp program name consistent.
24 @macro tramp
25 @sc{tramp}
26 @end macro
28 @c Some flags which make the text independent on the (X)Emacs flavor.
29 @c "emacs" resp "xemacs" are set in the Makefile.
31 @c Emacs values.
32 @ifset emacs
33 @set emacs-name               Emacs
34 @set emacs-dir                emacs
35 @set ftp-package-name         Ange-FTP
36 @set tramp-prefix             /
37 @set tramp-prefix-single-hop
38 @set tramp-postfix            :
39 @set tramp-postfix-single-hop :
40 @set tramp-postfix-multi-hop  :
41 @end ifset
43 @c XEmacs counterparts.
44 @ifset xemacs
45 @set emacs-name               XEmacs
46 @set emacs-dir                xemacs
47 @set ftp-package-name         EFS
48 @set tramp-prefix             /[
49 @set tramp-prefix-single-hop  [
50 @set tramp-postfix            ]
51 @set tramp-postfix-single-hop /
52 @set tramp-postfix-multi-hop  :
53 @end ifset
55 @c Macros for formatting a filename.
56 @c trampfn is for a full filename, trampfnmhp means method, host, localname
57 @c were given, and so on.
58 @macro trampfn(method, user, host, localname)
59 @value{tramp-prefix}@value{method}@value{user}@@@value{host}@value{tramp-postfix}@value{localname}
60 @end macro
62 @copying
63 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003 Free Software
64 Foundation, Inc.
66 @quotation     
67 Permission is granted to copy, distribute and/or modify this document
68 under the terms of the GNU Free Documentation License, Version 1.1 or
69 any later version published by the Free Software Foundation; with no
70 Invariant Sections, with the Front-Cover texts being ``A GNU
71 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
72 license is included in the section entitled ``GNU Free Documentation
73 License'' in the Emacs manual.
75 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
76 this GNU Manual, like GNU software.  Copies published by the Free
77 Software Foundation raise funds for GNU development.''
79 This document is part of a collection distributed under the GNU Free
80 Documentation License.  If you want to distribute this document
81 separately from the collection, you can do so by adding a copy of the
82 license to the document, as described in section 6 of the license.
83 @end quotation
84 @end copying
86 @tex
88 @titlepage
89 @title @tramp{} version @trampver{} User Manual
91 @author by Daniel Pittman
92 @author based on documentation by Kai Gro@ss{}johann
94 @page
95 @insertcopying
97 @end titlepage
98 @page
100 @end tex
102 @ifnottex
103 @node Top, Overview, (dir), (dir)
104 @top @tramp{} version @trampver{} User Manual
106 This file documents @tramp{} version @trampver{}, a remote file
107 editing package for @value{emacs-name}.
109 @tramp{} stands for `Transparent Remote (file) Access, Multiple
110 Protocol'.  This package provides remote file editing, similar to
111 @value{ftp-package-name}.
113 The difference is that @value{ftp-package-name} uses FTP to transfer
114 files between the local and the remote host, whereas @tramp{} uses a
115 combination of @command{rsh} and @command{rcp} or other work-alike
116 programs, such as @command{ssh}/@command{scp}.
118 You can find the latest version of this document on the web at
119 @uref{http://www.freesoftware.fsf.org/tramp/}.
121 @ifhtml
122 This manual is also available as a @uref{tramp_ja.html, Japanese
123 translation}.
125 The latest release of @tramp{} is available for
126 @uref{http://savannah.gnu.org/download/tramp/,
127 download}, or you may see @ref{Obtaining @tramp{}} for more details,
128 including the CVS server details.
130 @tramp{} also has a @uref{https://savannah.gnu.org/projects/tramp/,
131 Savannah Project Page}.
132 @end ifhtml
134 There is a mailing list for @tramp{}, available at
135 @email{tramp-devel@@mail.freesoftware.fsf.org}, and archived at
136 @uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/} as
137 well as the usual Savannah archives.
139 @insertcopying
141 @end ifnottex
143 @menu
144 * Overview::                    What @tramp{} can and cannot do.
146 For the end user:
147 * Obtaining @tramp{}::             How to obtain @tramp{}.
148 * History::                     History of @tramp{}.
149 * Installation::                Installing @tramp{} with your @value{emacs-name}.
150 * Configuration::               Configuring @tramp{} for use.
151 * Usage::                       An overview of the operation of @tramp{}.
152 * Bug Reports::                 Reporting Bugs and Problems.
153 * Frequently Asked Questions::  Questions and answers from the mailing list.
155 For the developer:
156 * Version Control::             The inner workings of remote version control.
157 * Files directories and localnames::  How file names, directories and localnames are mangled and managed.
158 * Issues::                      Debatable Issues and What Was Decided.
160 @detailmenu
161  --- The Detailed Node Listing ---
163 Configuring @tramp{} for use
165 * Connection types::            Types of connections made to remote machines.
166 * Inline methods::              Inline methods.
167 * External transfer methods::   External transfer methods.
168 * Multi-hop Methods::           Connecting to a remote host using multiple hops.
169 * Default Method::              Selecting a default method.
170 * Customizing Methods::         Using Non-Standard Methods.
171 * Customizing Completion::      Selecting config files for user/host name completion.
172 * Remote Programs::             How @tramp{} finds and uses programs on the remote machine.
173 * Remote shell setup::          Remote shell setup hints.
174 * Windows setup hints::         Issues with Cygwin ssh.
175 * Auto-save and Backup::        Auto-save and Backup.
177 Using @tramp
179 * Filename Syntax::             @tramp{} filename conventions.
180 * Multi-hop filename syntax::   Multi-hop filename conventions.
181 * Filename completion::         Filename completion.
182 * Dired::                       Dired.
184 The inner workings of remote version control
186 * Version Controlled Files::    Determining if a file is under version control.
187 * Remote Commands::             Executing the version control commands on the remote machine.
188 * Changed workfiles::           Detecting if the working file has changed.
189 * Checking out files::          Bringing the workfile out of the repository.
190 * Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
192 Things related to Version Control that don't fit elsewhere
194 * Remote File Ownership::       How VC determines who owns a workfile.
195 * Back-end Versions::           How VC determines what release your RCS is.
197 How file names, directories and localnames are mangled and managed.
199 * Localname deconstruction::    Breaking a localname into its components.
201 @end detailmenu
202 @end menu
204 @node Overview
205 @chapter An overview of @tramp
206 @cindex overview
208 After the installation of @tramp{} into your @value{emacs-name}, you
209 will be able to access files on remote machines as though they were
210 local.  Access to the remote file system for editing files, version
211 control, and @command{dired} are transparently enabled.
213 Your access to the remote machine can be with the @command{rsh},
214 @command{rlogin}, @command{telnet} programs or with any similar
215 connection method.  This connection must pass ASCII successfully to be
216 usable but need not be 8-bit clean.
218 The package provides support for @command{ssh} connections out of the
219 box, one of the more common uses of the package.  This allows
220 relatively secure access to machines, especially if @command{ftp}
221 access is disabled.
223 The majority of activity carried out by @tramp{} requires only that
224 the remote login is possible and is carried out at the terminal.  In
225 order to access remote files @tramp{} needs to transfer their content
226 to the local machine temporarily.
228 @tramp{} can transfer files between the machines in a variety of ways.
229 The details are easy to select, depending on your needs and the
230 machines in question.
232 The fastest transfer methods (for large files) rely on a remote file
233 transfer package such as @command{rcp}, @command{scp} or
234 @command{rsync}.  The use of these methods is only possible if the
235 file copy command does not ask for a password for the remote machine.
237 If the remote copy methods are not suitable for you, @tramp{} also
238 supports the use of encoded transfers directly through the shell.
239 This requires that the @command{mimencode} or @command{uuencode} tools
240 are available on the remote machine.  These methods are generally
241 faster for small files.
243 Within these limitations, @tramp{} is quite powerful.  It is worth
244 noting that, as of the time of writing, it is far from a polished
245 end-user product.  For a while yet you should expect to run into rough
246 edges and problems with the code now and then.
248 It is finished enough that the developers use it for day to day work but
249 the installation and setup can be a little difficult to master, as can
250 the terminology.
252 @tramp{} is still under active development and any problems you encounter,
253 trivial or major, should be reported to the @tramp{} developers.
254 @xref{Bug Reports}.
257 @subsubheading Behind the scenes
258 @cindex behind the scenes
259 @cindex details of operation
260 @cindex how it works
262 This section tries to explain what goes on behind the scenes when you
263 access a remote file through @tramp{}.
265 Suppose you type @kbd{C-x C-f} and enter part of an @tramp{} file name,
266 then hit @kbd{@key{TAB}} for completion.  Suppose further that this is
267 the first time that @tramp{} is invoked for the host in question.  Here's
268 what happens:
270 @itemize
271 @item
272 @tramp{} discovers that it needs a connection to the host.  So it
273 invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
274 @var{user}} or a similar tool to connect to the remote host.
275 Communication with this process happens through an
276 @value{emacs-name} buffer, that is, the output from the remote end
277 goes into a buffer.
279 @item
280 The remote host may prompt for a login name (for @command{telnet}).  The
281 login name is given in the file name, so @tramp{} sends the login name and
282 a newline.
284 @item
285 The remote host may prompt for a password or pass phrase (for
286 @command{rsh} or for @command{telnet} after sending the login name).
287 @tramp{} displays the prompt in the minibuffer, asking you for the
288 password or pass phrase.
290 You enter the password or pass phrase.  @tramp{} sends it to the remote
291 host, followed by a newline.
293 @item
294 @tramp{} now waits for the shell prompt or for a message that the login
295 failed.
297 If @tramp{} sees neither of them after a certain period of time (a minute,
298 say), then it issues an error message saying that it couldn't find the
299 remote shell prompt and shows you what the remote host has sent.
301 If @tramp{} sees a @samp{login failed} message, it tells you so,
302 aborts the login attempt and allows you to try again.
304 @item
305 Suppose that the login was successful and @tramp{} sees the shell prompt
306 from the remote host.  Now @tramp{} invokes @command{/bin/sh} because
307 Bourne shells and C shells have different command
308 syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
309 shell doesn't recognize @samp{exec /bin/sh} as a valid command.
310 Maybe you use the Scheme shell @command{scsh}@dots{}}
312 After the Bourne shell has come up, @tramp{} sends a few commands to
313 ensure a good working environment.  It turns off echoing, it sets the
314 shell prompt, and a few other things.
316 @item
317 Now the remote shell is up and it good working order.  Remember, what
318 was supposed to happen is that @tramp{} tries to find out what files exist
319 on the remote host so that it can do filename completion.
321 So, @tramp{} basically issues @command{cd} and @command{ls} commands and
322 also sometimes @command{echo} with globbing.  Another command that is
323 often used is @command{test} to find out whether a file is writable or a
324 directory or the like.  The output of each command is parsed for the
325 necessary operation.
327 @item
328 Suppose you are finished with filename completion, have entered @kbd{C-x
329 C-f}, a full file name and hit @kbd{@key{RET}}.  Now comes the time to
330 transfer the file contents from the remote host to the local host so
331 that you can edit them.
333 See above for an explanation of how @tramp{} transfers the file contents.
335 For inline transfers, @tramp{} issues a command like @samp{mimencode -b
336 /path/to/remote/file}, waits until the output has accumulated in the
337 buffer that's used for communication, then decodes that output to
338 produce the file contents.
340 For out-of-band transfers, @tramp{} issues a command like the following:
341 @example
342 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
343 @end example
344 It then reads the local temporary file @file{/tmp/tramp.4711} into a
345 buffer and deletes the temporary file.
347 @item
348 You now edit the buffer contents, blithely unaware of what has happened
349 behind the scenes.  (Unless you have read this section, that is.)  When
350 you are finished, you type @kbd{C-x C-s} to save the buffer.
352 @item
353 Again, @tramp{} transfers the file contents to the remote host either
354 inline or out-of-band.  This is the reverse of what happens when reading
355 the file.
357 @end itemize
359 I hope this has provided you with a basic overview of what happens
360 behind the scenes when you open a file with @tramp{}.
363 @c For the end user
364 @node Obtaining @tramp{}
365 @chapter Obtaining @tramp{}.
366 @cindex obtaining Tramp
368 @tramp{} is freely available on the Internet and the latest release
369 may be downloaded from
370 @uref{http://savannah.nongnu.org/download/tramp/}. This
371 release includes the full documentation and code for @tramp{},
372 suitable for installation.  But Emacs (21.4 or later) includes
373 @tramp{} already, and there is a @tramp{} package for XEmacs, as well.
374 So maybe it is easier to just use those.  But if you want the bleeding
375 edge, read on@dots{...}
377 For the especially brave, @tramp{} is available from CVS.  The CVS
378 version is the latest version of the code and may contain incomplete
379 features or new issues. Use these versions at your own risk.
381 Instructions for obtaining the latest development version of @tramp{}
382 from CVS can be found by going to the Savannah project page at the
383 following URL and then clicking on the CVS link in the navigation bar
384 at the top.
386 @noindent
387 @uref{http://savannah.gnu.org/projects/tramp/}
389 @noindent
390 Or follow the example session below:
392 @example
393 ] @strong{cd ~/@value{emacs-dir}}
394 ] @strong{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp login}
396 (Logging in to anoncvs@@subversions.gnu.org)
397 CVS password: @strong{(just hit RET here)}
398 @dots{}
400 ] @strong{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp co tramp}
401 @end example
403 @noindent
404 You should now have a directory @file{~/@value{emacs-dir}/tramp}
405 containing the latest version of @tramp{}. You can fetch the latest
406 updates from the repository by issuing the command:
408 @example
409 ] @strong{cd ~/@value{emacs-dir}/tramp}
410 ] @strong{cvs update -d}
411 @end example
413 @noindent
414 Once you've got updated files from the CVS repository, you need to run
415 @command{autoconf} in order to get an up-to-date @file{configure}
416 script:
418 @example
419 ] @strong{cd ~/@value{emacs-dir}/tramp}
420 ] @strong{autoconf}
421 @end example
424 @node History
425 @chapter History of @tramp{}
426 @cindex history
427 @cindex development history
429 Development was started end of November 1998.  The package was called
430 @file{rssh.el}, back then.  It only provided one method to access a
431 file, using @command{ssh} to log in to a remote host and using
432 @command{scp} to transfer the file contents.  After a while, the name
433 was changed to @file{rcp.el}, and now it's @tramp{}.  Along the way,
434 many more methods for getting a remote shell and for transferring the
435 file contents were added.  Support for VC was added.
437 The most recent addition of major features were the multi-hop methods
438 added in April 2000 and the unification of @tramp{} and Ange-FTP
439 filenames in July 2002.
442 @node Installation
443 @chapter Installing @tramp{} into @value{emacs-name}.
444 @cindex installation
446 If you use the version that comes with your @value{emacs-name}, the
447 following information is not necessary.  Installing @tramp{} into your
448 @value{emacs-name} is a relatively easy process, at least compared
449 to rebuilding your machine from scratch. ;)
451 Seriously though, the installation should be a fairly simple matter.
452 The easiest way to proceed is as follows:
454 @itemize @bullet
455 @item
456 Choose a directory, say @file{~/@value{emacs-dir}/}.  Change into that
457 directory and unpack the tarball.  This will give you a directory
458 @file{~/@value{emacs-dir}/tramp-@trampver{}/} which contains
459 subdirectories @file{lisp} for the Lisp code and @file{texi} for the
460 documentation.  Make a symbolic link:
462 @example
463 ln -s tramp-@trampver{} tramp
464 @end example
466 @item
467 @command{cd} to @file{~/@value{emacs-dir}/tramp/} and type
468 @command{./configure} to configure Tramp for your system.
470 Running `configure' takes awhile.  While running, it prints some
471 messages telling which features it is checking for.
473 @item
474 Type @command{make} to build the byte-compiled Lisp files as well as
475 the Info manual.
477 @item
478 Type @command{make install} to install the Tramp Lisp files and Info
479 manual.
481 @item
482 You can remove the byte-compiled Lisp files and the Info manual from
483 the source directory by typing @command{make clean}.  To also remove
484 the files that @command{configure} created, type @command{make
485 distclean}.
487 @item
488 NOTE: If you run into problems running the example @command{make}
489 command, don't despair.  You can still byte compile the @file{*.el}
490 files by opening @value{emacs-name} in @command{dired} (@command{C-x
491 d}) mode, at @file{~/@value{emacs-dir}/tramp/lisp}.  Mark the lisp files with
492 @kbd{m}, then press @kbd{B} to byte compile your selections.
494 Something similar can be done to create the info manual.  Just change
495 to directory @file{~/@value{emacs-dir}/tramp/texi} and load the
496 @file{tramp.texi} file in @value{emacs-name}.  Then press @kbd{M-x
497 texinfo-format-buffer @key{RET}} to generate
498 @file{~/@value{emacs-dir}/tramp/info/tramp}.
499 @end itemize
501 @menu
502 * Installation parameters::     Parameters in order to control installation.
503 * Load paths::                  How to plug-in @tramp{} into your environment.
504 @end menu
506 @node Installation parameters
507 @section Parameters in order to control installation.
508 @cindex installation
510 By default, @command{make install} will install @tramp{}'s files in
511 @file{@value{lispdir}} and @file{@value{infodir}}.  You can specify an
512 installation prefix other than @file{@value{prefix}} by giving
513 @command{configure} the option @command{--prefix=PATH}.
515 If your installed copy of Emacs is named something other than
516 @command{@value{emacs-dir}}, you will need to tell `make' where to find it so
517 that it can correctly byte-compile the @tramp{} sources.
519 Also, the @command{--prefix=PATH} option to @command{configure} may
520 not be general enough to set the paths you want.  If not, you can pass
521 variables to the @command{make} command to control the installation.
522 For a complete list of tweakable variables, look in the makefile.
524 For example, to put the Lisp files in @file{~/elisp} and the Info file
525 in @file{~/info}, you would type:
527 @example
528 ./configure
529 make
530 make lispdir=~/elisp infodir=~/info install
531 @end example
533 @tramp{} has some packages in its @file{contrib} directory which are
534 missing in older Emacsen.  If you want to use them, you must use the
535 @command{USE_CONTRIB} environment variable:
537 @example
538 make USE_CONTRIB=1
539 make USE_CONTRIB=1 install
540 @end example
542 @node Load paths
543 @section How to plug-in @tramp{} into your environment.
544 @cindex installation
546 If you don't install @tramp{} into the intended directories, but prefer
547 to use from the source directory, you need to add the following lines
548 into your @file{.emacs}:
550 @lisp
551 (add-to-list 'load-path "~/@value{emacs-dir}/tramp/lisp/")
552 (add-to-list 'load-path "~/@value{emacs-dir}/tramp/contrib/")
553 (require 'tramp)
554 @end lisp
556 The second load-path must be used only if you've applied the
557 @command{USE_CONTRIB} parameter.
559 @ifset xemacs
560 NOTE: For @value{emacs-name}, the package @file{fsf-compat} must be
561 installed.  For details on package installation, see @ref{Packages, ,
562 ,xemacs}.
563 @ifhtml
564 (If the previous link doesn't work, try the @value{emacs-name}
565 documentation at
566 @uref{http://www.xemacs.org/Documentation/packageGuide.html,the
567 @value{emacs-name} site}.)
568 @end ifhtml
569 @end ifset
571 To be able to read the Info documentation, create a file
572 @file{~/@value{emacs-dir}/tramp/info/dir} using the
573 @command{install-info} command, and add the directory to the search
574 path for Info.
576 NOTE:
577 On systems using the @cite{gnu} version of @command{install-info}, the
578 @command{install-info} syntax is very direct and simple.  One can
579 change to directory @file{~/@value{emacs-dir}/tramp/info} and type:
581 @example
582 install-info tramp dir
583 @end example
585 and a @file{dir} file will be created with the @tramp{}
586 entry.  The info reader will know how to interpret it, but must
587 be told where to find it (see below).  If you want anything fancier
588 you'll need to look through @kbd{man install-info}.
590 Debian gnu/linux doesn't default to @cite{gnu} @command{install-info}
591 and uses its own version.  This version does not create a @file{dir}
592 file for you from scratch.  You must provide a skeleton @file{dir}
593 file it recognizes.  One can be found in a default installation of
594 @value{emacs-name} at @file{/usr/info/dir}.  Copy the top of this file
595 down to the first occurrence of @code{* Menu} including that line plus
596 one more blank line, to your working directory
597 @file{~/@value{emacs-dir}/tramp/info}, or use the sample
598 @file{~/@value{emacs-dir}/tramp/texi/dir_sample}.
600 Once a @file{dir} file is in place, this command will make the entry:
602 @example
603 install-info --infodir=. tramp
604 @end example
606 If you want it in a specific category see @kbd{man install-info} for
607 further details.
609 If the environment variable @env{INFOPATH} is set, add the directory
610 @file{~/@value{emacs-dir}/tramp/info/} to it.  Else, add the directory to
611 @ifset emacs
612 @code{Info-default-directory-list}, as follows:
614 @lisp
615 (add-to-list 'Info-default-directory-list "~/@value{emacs-dir}/tramp/info/")
616 @end lisp
617 @end ifset
618 @ifset xemacs
619 @code{Info-directory-list}, as follows:
620 @lisp
621 (add-to-list 'Info-directory-list "~/@value{emacs-dir}/tramp/info/")
622 @end lisp
623 @end ifset
625 @node Configuration
626 @chapter Configuring @tramp{} for use
627 @cindex configuration
629 @cindex default configuration
630 @tramp{} is (normally) fully functional when it is initially
631 installed.  It is initially configured to use the @command{ssh} program
632 to connect to the remote host and to use base-64 encoding (on the
633 remote host, via @command{mimencode}, and on the local host via the
634 built-in support for base-64 encoding in Emacs).
636 On some hosts, there are problems with opening a connection.  These are
637 related to the behavior of the remote shell.  See @xref{Remote shell
638 setup}, for details on this.
640 If you do not wish to use these commands to connect to the remote
641 host, you should change the default connection and transfer method
642 that @tramp uses.  There are several different methods that @tramp{}
643 can use to connect to remote machines and transfer files
644 (@pxref{Connection types}).
647 @menu
648 * Connection types::            Types of connections made to remote machines.
649 * Inline methods::              Inline methods.
650 * External transfer methods::   External transfer methods.
651 * Multi-hop Methods::           Connecting to a remote host using multiple hops.
652 * Default Method::              Selecting a default method.
653 * Customizing Methods::         Using Non-Standard Methods.
654 * Customizing Completion::      Selecting config files for user/host name completion.
655 * Remote Programs::             How @tramp{} finds and uses programs on the remote machine.
656 * Remote shell setup::          Remote shell setup hints.
657 * Windows setup hints::         Issues with Cygwin ssh.
658 * Auto-save and Backup::        Auto-save and Backup.
659 @end menu
662 @node Connection types
663 @section Types of connections made to remote machines.
664 @cindex connection types, overview
666 There are two basic types of transfer methods, each with its own
667 advantages and limitations.  Both types of connection make use of a
668 remote shell access program such as @command{rsh}, @command{ssh} or
669 @command{telnet} to connect to the remote machine.
671 This connection is used to perform many of the operations that @tramp
672 requires to make the remote file system transparently accessible from
673 the local machine. It is only when visiting files that the methods
674 differ.
676 @cindex inline methods
677 @cindex external transfer methods
678 @cindex external methods
679 @cindex out-of-band methods
680 @cindex methods, inline
681 @cindex methods, external transfer
682 @cindex methods, out-of-band
683 Loading or saving a remote file requires that the content of the file
684 be transfered between the two machines. The content of the file can be
685 transfered over the same connection used to log in to the remote
686 machine or the file can be transfered through another connection using
687 a remote copy program such as @command{rcp}, @command{scp} or
688 @command{rsync}.  The former are called @dfn{inline methods}, the
689 latter are called @dfn{out-of-band methods} or @dfn{external transfer
690 methods} (@dfn{external methods} for short).
692 The performance of the external transfer methods is generally better
693 than that of the inline methods, at least for large files.  This is
694 caused by the need to encode and decode the data when transferring
695 inline.
697 The one exception to this rule are the @command{scp} based transfer
698 methods.  While these methods do see better performance when actually
699 transferring files, the overhead of the cryptographic negotiation at
700 startup may drown out the improvement in file transfer times.
702 External transfer methods do require that the remote copy command is not
703 interactive --- that is, the command does not prompt you for a password.
704 If you cannot perform remote copies without a password, you will need to
705 use an inline transfer method to work with @tramp{}.
707 @cindex multi-hop methods
708 @cindex methods, multi-hop
709 A variant of the inline methods are the @dfn{multi-hop methods}.
710 These methods allow you to connect a remote host using a number `hops',
711 each of which connects to a different host.  This is useful if you are
712 in a secured network where you need to go through a bastion host to
713 connect to the outside world.
716 @node Inline methods
717 @section Inline methods
718 @cindex inline methods
719 @cindex methods, inline
721 The inline methods in @tramp{} are quite powerful and can work in
722 situations where you cannot use an external transfer program to connect.
723 Inline methods are the only methods that work when connecting to the
724 remote machine via telnet.  (There are also strange inline methods which
725 allow you to transfer files between @emph{user identities} rather than
726 hosts, see below.)
728 These methods depend on the existence of a suitable encoding and
729 decoding command on remote machine.  Locally, @tramp{} may be able to use
730 features of Emacs to decode and encode the files or it may require
731 access to external commands to perform that task.
733 @cindex uuencode
734 @cindex mimencode
735 @cindex base-64 encoding
736 @tramp{} checks the availability and usability of commands like
737 @command{mimencode} (part of the @command{metamail} package) or
738 @command{uuencode} on the remote host.  The first reliable command
739 will be used.  The search path can be customized, see @ref{Remote
740 Programs}.
742 If both commands aren't available on the remote host, @tramp{}
743 transfers a small piece of Perl code to the remote host, and tries to
744 apply it for encoding and decoding.
747 @table @asis
748 @item @option{rsh}
749 @cindex method rsh
750 @cindex rsh method
752 Connect to the remote host with @command{rsh}.  Due to the unsecure
753 connection it is recommended for very local host topology only.
756 @item @option{ssh}
757 @cindex method ssh
758 @cindex ssh method
760 Connect to the remote host with @command{ssh}.  This is identical to
761 the previous option except that the @command{ssh} package is used,
762 making the connection more secure.
764 There are also two variants, @option{ssh1} and @option{ssh2}, that
765 call @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
766 explicitly select whether you want to use the SSH protocol version 1
767 or 2 to connect to the remote host.  (You can also specify in
768 @file{~/.ssh/config}, the SSH configuration file, which protocol
769 should be used, and use the regular @option{ssh} method.)
771 Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
772 @command{ssh1} and @command{ssh2} commands explicitly.  If you don't
773 know what these are, you do not need these options.
775 All the methods based on @command{ssh} have an additional kludgy
776 feature: you can specify a host name which looks like @file{host#42}
777 (the real host name, then a hash sign, then a port number).  This
778 means to connect to the given host but to also pass @code{-p 42} as
779 arguments to the @command{ssh} command.
782 @item @option{telnet}
783 @cindex method telnet
784 @cindex telnet method
786 Connect to the remote host with @command{telnet}.  This is as unsecure
787 as the @option{rsh} method.
790 @item @option{su}
791 @cindex method su
792 @cindex su method
794 This method does not connect to a remote host at all, rather it uses
795 the @command{su} program to allow you to edit files as another user.
798 @item @option{sudo}
799 @cindex method sudo
800 @cindex sudo method
802 This is similar to the @option{su} method, but it uses @command{sudo}
803 rather than @command{su} to become a different user.
805 Note that @command{sudo} must be configured to allow you to start a
806 shell as the user.  It would be nice if it was sufficient if
807 @command{ls} and @command{mimencode} were allowed, but that is not
808 easy to implement, so I haven't got around to it, yet.
811 @item @option{sshx}
812 @cindex method sshx
813 @cindex sshx method
814 @cindex Cygwin (with sshx method)
816 As you expect, this is similar to @option{ssh}, only a little
817 different.  Whereas @option{ssh} opens a normal interactive shell on
818 the remote host, this option uses @samp{ssh -t -t @var{host} -l
819 @var{user} /bin/sh} to open a connection.  This is useful for users
820 where the normal login shell is set up to ask them a number of
821 questions when logging in.  This procedure avoids these questions, and
822 just gives @tramp{} a more-or-less `standard' login shell to work
823 with.
825 Note that this procedure does not eliminate questions asked by
826 @command{ssh} itself.  For example, @command{ssh} might ask ``Are you
827 sure you want to continue connecting?'' if the host key of the remote
828 host is not known.  @tramp{} does not know how to deal with such a
829 question (yet), therefore you will need to make sure that you can log
830 in without such questions.
832 This is also useful for Windows users where @command{ssh}, when
833 invoked from an Emacs buffer, tells them that it is not allocating a
834 pseudo tty.  When this happens, the login shell is wont to not print
835 any shell prompt, which confuses @tramp{} mightily.  For reasons
836 unknown, some Windows ports for @command{ssh} (maybe the Cygwin one)
837 require the doubled @samp{-t} option.
839 This supports the @samp{-p} kludge.
842 @item @option{krlogin}
843 @cindex method krlogin
844 @cindex km krlogin
845 @cindex Kerberos (with krlogin method)
847 This method is also similar to @option{ssh}.  It only uses the
848 @command{krlogin -x} command to log in to the remote host.
851 @item @option{plink}
852 @cindex method plink
853 @cindex plink method
855 This method is mostly interesting for Windows users using the PuTTY
856 implementation of SSH.  It uses @samp{plink -ssh} to log in to the
857 remote host.
859 CCC: Do we have to connect to the remote host once from the command
860 line to accept the SSH key?  Maybe this can be made automatic?
862 CCC: Does @command{plink} support the @samp{-p} option?  @tramp{} will
863 support that, anyway.
865 @end table
869 @node External transfer methods
870 @section External transfer methods
871 @cindex methods, external transfer
872 @cindex methods, out-of-band
873 @cindex external transfer methods
874 @cindex out-of-band methods
876 The external transfer methods operate through multiple channels, using
877 the remote shell connection for many actions while delegating file
878 transfers to an external transfer utility.
880 This saves the overhead of encoding and decoding that multiplexing the
881 transfer through the one connection has with the inline methods.
883 If you want to use an external transfer method you @emph{must} be able
884 to execute the transfer utility to copy files to and from the remote
885 machine without any interaction.
887 @cindex ssh-agent
888 This means that you will need to use @command{ssh-agent} if you use the
889 @command{scp} program for transfers, or maybe your version of
890 @command{scp} accepts a password on the command line.@footnote{PuTTY's
891 @command{pscp} allows you to specify the password on the command line.}
892 If you use @command{rsync} via @command{ssh} then the same rule must
893 apply to that connection.
895 If you cannot get @command{scp} to run without asking for a password but
896 would still like to use @command{ssh} to secure your connection, have a
897 look at the @command{ssh} based inline methods.
900 @table @asis
901 @item @option{rcp}  ---  @command{rsh} and @command{rcp}
902 @cindex method rcp
903 @cindex rcp method
904 @cindex rcp (with rcp method)
905 @cindex rsh (with rcp method)
907 This method uses the @command{rsh} and @command{rcp} commands to connect
908 to the remote machine and transfer files. This is probably the fastest
909 connection method available.
912 @item @option{scp}  ---  @command{ssh} and @command{scp}
913 @cindex method scp
914 @cindex scp method
915 @cindex scp (with scp method)
916 @cindex ssh (with scp method)
918 Using @command{ssh} to connect to the remote host and @command{scp} to
919 transfer files between the machines is the best method for securely
920 connecting to a remote machine and accessing files.
922 The performance of this option is also quite good. It may be slower than
923 the inline methods when you often open and close small files however.
924 The cost of the cryptographic handshake at the start of an @command{scp}
925 session can begin to absorb the advantage that the lack of encoding and
926 decoding presents.
928 There are also two variants, @option{scp1} and @option{scp2}, that
929 call @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
930 explicitly select whether you want to use the SSH protocol version 1
931 or 2 to connect to the remote host.  (You can also specify in
932 @file{~/.ssh/config}, the SSH configuration file, which protocol
933 should be used, and use the regular @option{ssh} method.)
935 Two other variants, @option{scp1_old} and @option{scp2_old}, use the
936 @command{ssh1} and @command{ssh2} commands explicitly.  If you don't
937 know what these are, you do not need these options.
939 All the @command{ssh} based methods support the kludgy @samp{-p}
940 feature where you can specify a port number to connect to in the host
941 name.  For example, the host name @file{host#42} tells @tramp{} to
942 specify @samp{-p 42} in the argument list for @command{ssh}.
945 @item @option{rsync}  ---  @command{ssh} and @command{rsync}
946 @cindex method rsync
947 @cindex rsync method
948 @cindex rsync (with rsync method)
949 @cindex ssh (with rsync method)
951 Using the @command{ssh} command to connect securely to the remote
952 machine and the @command{rsync} command to transfer files is almost
953 identical to the @option{scp} method.
955 While @command{rsync} performs much better than @command{scp} when
956 transferring files that exist on both hosts, this advantage is lost if
957 the file exists only on one side of the connection.
959 The @command{rsync} based method may be considerably faster than the
960 @command{rcp} based methods when writing to the remote system. Reading
961 files to the local machine is no faster than with a direct copy.
963 This method supports the @samp{-p} hack.
966 @item @option{scpx} --- @command{ssh} and @command{scp}
967 @cindex method scpx
968 @cindex scpx method
969 @cindex scp (with scpx method)
970 @cindex ssh (with scpx method)
971 @cindex Cygwin (with scpx method)
973 As you expect, this is similar to @option{scp}, only a little
974 different.  Whereas @option{scp} opens a normal interactive shell on
975 the remote host, this option uses @samp{ssh -t -t @var{host} -l
976 @var{user} /bin/sh} to open a connection.  This is useful for users
977 where the normal login shell is set up to ask them a number of
978 questions when logging in.  This procedure avoids these questions, and
979 just gives @tramp{} a more-or-less `standard' login shell to work
980 with.
982 This is also useful for Windows users where @command{ssh}, when
983 invoked from an Emacs buffer, tells them that it is not allocating a
984 pseudo tty.  When this happens, the login shell is wont to not print
985 any shell prompt, which confuses @tramp{} mightily.  Maybe this
986 applies to the Cygwin port of SSH.
988 This method supports the @samp{-p} hack.
991 @item @option{pscp} --- @command{plink} and @command{pscp}
992 @cindex method pscp
993 @cindex pscp method
994 @cindex pscp (with pscp method)
995 @cindex plink (with pscp method)
996 @cindex PuTTY (with pscp method)
998 This method is similar to @option{scp}, but it uses the
999 @command{plink} command to connect to the remote host, and it uses
1000 @command{pscp} for transferring the files.  These programs are part
1001 of PuTTY, an SSH implementation for Windows.
1003 CCC: Does @command{plink} support the @samp{-p} hack?
1006 @item @option{fcp} --- @command{fsh} and @command{fcp}
1007 @cindex method fcp
1008 @cindex fcp method
1009 @cindex fsh (with fcp method)
1010 @cindex fcp (with fcp method)
1012 This method is similar to @option{scp}, but it uses the @command{fsh}
1013 command to connect to the remote host, and it uses @command{fcp} for
1014 transferring the files.  @command{fsh/fcp} are a front-end for
1015 @command{ssh} which allow for reusing the same @command{ssh} session
1016 for submitting several commands.  This avoids the startup overhead of
1017 @command{scp} (which has to establish a secure connection whenever it
1018 is called).  Note, however, that you can also use one of the inline
1019 methods to achieve a similar effect.
1021 This method uses the command @samp{fsh @var{host} -l @var{user}
1022 /bin/sh -i} to establish the connection, it does not work to just say
1023 @command{fsh @var{host} -l @var{user}}.
1025 @cindex method fsh
1026 @cindex fsh method
1027 There is no inline method using @command{fsh} as the multiplexing
1028 provided by the program is not very useful in our context.  @tramp{}
1029 opens just one connection to the remote host and then keeps it open,
1030 anyway.
1033 @ifset emacs
1034 @item @option{ftp}
1035 @cindex method ftp
1036 @cindex ftp method
1038 This is not a native @tramp{} method. Instead of, it forwards all
1039 requests to @value{ftp-package-name}.
1040 @end ifset
1043 @item @option{smb} --- @command{smbclient}
1044 @cindex method smb
1045 @cindex smb method
1047 This is another not natural @tramp{} method.  It uses the
1048 @command{smbclient} command on different Unices in order to connect to
1049 an SMB server.  An SMB server might be a Samba (or CIFS) server on
1050 another UNIX host or, more interesting, a host running MS Windows.  So
1051 far, it is tested towards MS Windows NT, MS Windows 2000, and MS
1052 Windows XP.
1054 The first directory in the localname must be a share name on the remote
1055 host.  Remember, that the @code{$} character in which default shares
1056 usually end, must be written @code{$$} due to environment variable
1057 substitution in file names.  If no share name is given (i.e. remote
1058 directory @code{/}), all available shares are listed.
1060 Since authorization is done on share level, you will be prompted
1061 always for a password if you access another share on the same host.
1062 Due to security reasons, the password is not cached.
1064 MS Windows uses for authorization both a user name and a domain name.
1065 Because of this, the @tramp{} syntax has been extended: you can
1066 specify a user name which looks like @code{user%domain} (the real user
1067 name, then a percent sign, then the domain name).  So, to connect to
1068 the machine @code{melancholia} as user @code{daniel} of the domain
1069 @code{BIZARRE}, and edit @file{.emacs} in the home directory (share
1070 @code{daniel$}) I would specify the filename
1071 @file{@value{tramp-prefix}smb@value{tramp-postfix-single-hop}daniel%BIZARRE@@melancholia@value{tramp-postfix}/daniel$$/.emacs}.
1073 The domain name as well as the user name are optional.  If no user
1074 name is specified at all, the anonymous user (without password
1075 prompting) is assumed.  This is different from all other @tramp{}
1076 methods, where in such a case the local user name is taken.
1078 The @option{smb} method supports the @samp{-p} hack.
1080 @strong{Please note:} If Emacs runs locally under MS Windows, this
1081 method isn't available.  Instead of, you can use UNC file names like
1082 @file{//melancholia/daniel$$/.emacs}.  The only disadvantage is that
1083 there's no possiblity to specify another user name.
1085 @end table
1087 @node Multi-hop Methods
1088 @section Connecting to a remote host using multiple hops
1089 @cindex multi-hop methods
1090 @cindex methods, multi-hop
1092 Sometimes, the methods described before are not sufficient.  Sometimes,
1093 it is not possible to connect to a remote host using a simple command.
1094 For example, if you are in a secured network, you might have to log in
1095 to a `bastion host' first before you can connect to the outside world.
1096 Of course, the target host may also require a bastion host.  The format
1097 of multi-hop filenames is slightly different than the format of normal
1098 @tramp{} methods.
1100 @cindex method multi
1101 @cindex multi method
1102 A multi-hop file name specifies a method, a number of hops, and a
1103 localname (path name on the remote system).  The method name is always
1104 @option{multi}.
1106 Each hop consists of a @dfn{hop method} specification, a user name and
1107 a host name.  The hop method can be an inline method only.  The
1108 following hop methods are (currently) available:
1110 @table @option
1111 @item telnet
1112 @cindex hop method telnet
1113 @cindex telnet hop method
1115 Uses the well-known @command{telnet} program to connect to the host.
1116 Whereas user name and host name are supplied in the file name, the
1117 user is queried for the password.
1119 @item rsh
1120 @cindex hop method rsh
1121 @cindex rsh hop method
1123 This uses @command{rsh} to connect to the host.  You do not need to
1124 enter a password unless @command{rsh} explicitly asks for it.
1126 @item ssh
1127 @cindex hop method ssh
1128 @cindex ssh hop method
1130 This uses @command{ssh} to connect to the host.  You might have to enter
1131 a password or a pass phrase.
1133 @item su
1134 @cindex hop method su
1135 @cindex su hop method
1137 This method does not actually contact a different host, but it allows
1138 you to become a different user on the host you're currently on.  This
1139 might be useful if you want to edit files as root, but the remote host
1140 does not allow remote root logins.  In this case you can use
1141 @option{telnet}, @option{rsh} or @option{ssh} to connect to the
1142 remote host as a non-root user, then use an @option{su} hop to become
1143 root.  But @option{su} need not be the last hop in a sequence, you could
1144 also use it somewhere in the middle, if the need arises.
1146 Even though you @emph{must} specify both user and host with an
1147 @option{su} hop, the host name is ignored and only the user name is
1148 used.
1150 @item sudo
1151 @cindex hop method sudo
1152 @cindex sudo hop method
1154 This is similar to the @option{su} hop, except that it uses
1155 @command{sudo} rather than @command{su} to become a different user.
1157 @end table
1159 Some people might wish to use port forwarding with @command{ssh} or
1160 maybe they have to use a nonstandard port.  This can be accomplished
1161 by putting a stanza in @file{~/.ssh/config} for the account which
1162 specifies a different port number for a certain host name.  But it can
1163 also be accomplished within @tramp{}, by adding a multi-hop method.
1164 For example:
1166 @lisp
1167 (add-to-list
1168  'tramp-multi-connection-function-alist
1169  '("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n"))
1170 @end lisp
1172 Now you can use an @code{sshf} hop which connects to port 4400 instead of
1173 the standard port.
1176 @node Default Method
1177 @section Selecting a default method
1178 @cindex default method
1180 @vindex tramp-default-method
1181 When you select an appropriate transfer method for your typical usage
1182 you should set the variable @var{tramp-default-method} to reflect that
1183 choice.  This variable controls which method will be used when a method
1184 is not specified in the @tramp{} file name.  For example:
1186 @lisp
1187 (setq tramp-default-method "scp")
1188 @end lisp
1190 @vindex tramp-default-method-alist
1191 You can also specify different methods for certain user/host
1192 combinations, via the variable @var{tramp-default-method-alist}.  For
1193 example, the following two lines specify to use the @option{ssh}
1194 method for all user names matching @samp{john} and the @option{rsync}
1195 method for all host names matching @samp{lily}.  The third line
1196 specifies to use the @option{su} method for the user @samp{root} on
1197 the machine @samp{localhost}.
1199 @lisp
1200 (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
1201 (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1202 (add-to-list 'tramp-default-method-alist
1203              '("\\`localhost\\'" "\\`root\\'" "su"))
1204 @end lisp
1206 @noindent
1207 See the documentation for the variable
1208 @var{tramp-default-method-alist} for more details.
1210 External transfer methods are normally preferable to inline transfer
1211 methods, giving better performance. They may not be useful if you use
1212 many remote machines where you cannot log in without a password.
1214 @xref{Inline methods}.
1215 @xref{External transfer methods}.
1216 @xref{Multi-hop Methods}.
1218 Another consideration with the selection of transfer methods is the
1219 environment you will use them in and, especially when used over the
1220 Internet, the security implications of your preferred method.
1222 The @command{rsh} and @command{telnet} methods send your password as
1223 plain text as you log in to the remote machine, as well as transferring
1224 the files in such a way that the content can easily be read from other
1225 machines.
1227 If you need to connect to remote systems that are accessible from the
1228 Internet, you should give serious thought to using @command{ssh} based
1229 methods to connect. These provide a much higher level of security,
1230 making it a non-trivial exercise for someone to obtain your password or
1231 read the content of the files you are editing.
1233 @node Customizing Methods
1234 @section Using Non-Standard Methods
1235 @cindex customizing methods
1236 @cindex using non-standard methods
1237 @cindex create your own methods
1239 There is a variable @code{tramp-methods} which you can change if the
1240 predefined methods don't seem right.
1242 For the time being, I'll refer you to the Lisp documentation of that
1243 variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1246 @node Customizing Completion
1247 @section Selecting config files for user/host name completion
1248 @cindex customizing completion
1249 @cindex selecting config files
1250 @vindex tramp-completion-function-alist
1252 The variable @code{tramp-completion-function-alist} is intended to
1253 customize which files are taken into account for user and host name
1254 completion (@pxref{Filename completion}).  For every method, it keeps
1255 a set of configuration files, accompanied by a Lisp function able to
1256 parse that file.  Entries in @code{tramp-completion-function-alist}
1257 have the form (@var{method} @var{pair1} @var{pair2} ...).
1259 Each @var{pair} is composed of (@var{function} @var{file}).
1260 @var{function} is responsible to extract user names and host names
1261 from @var{file} for completion.  There are two functions which access
1262 this variable:
1264 @defun tramp-get-completion-function method
1265 This function returns the list of completion functions for @var{method}.
1267 Example:
1268 @example
1269 (tramp-get-completion-function "rsh")
1271      @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1272          (tramp-parse-rhosts "~/.rhosts"))
1273 @end example
1274 @end defun
1276 @defun tramp-set-completion-function method function-list
1277 This function sets @var{function-list} as list of completion functions
1278 for @var{method}. 
1280 Example:
1281 @example
1282 (tramp-set-completion-function "ssh"
1283  '((tramp-parse-sconfig "/etc/ssh_config")
1284    (tramp-parse-sconfig "~/.ssh/config")))
1286      @result{} ((tramp-parse-sconfig "/etc/ssh_config")
1287          (tramp-parse-sconfig "~/.ssh/config"))
1288 @end example
1289 @end defun
1291 The following predefined functions parsing configuration files exist:
1293 @table @asis
1294 @item @code{tramp-parse-rhosts}
1295 @findex tramp-parse-rhosts
1297 This function parses files which are syntactical equivalent to
1298 @file{~/.rhosts}.  It returns both host names and user names, if
1299 specified.
1301 @item @code{tramp-parse-shosts}
1302 @findex tramp-parse-shosts
1304 This function parses files which are syntactical equivalent to
1305 @file{~/.ssh/known_hosts}.  Since there are no user names specified
1306 in such files, it can return host names only.
1308 @item @code{tramp-parse-sconfig}
1309 @findex tramp-parse-shosts
1311 This function returns the host nicnames defined by @code{Host} entries
1312 in @file{~/.ssh/config} style files.
1314 @item @code{tramp-parse-hosts}
1315 @findex tramp-parse-hosts
1317 A function dedicated to @file{/etc/hosts} style files.  It returns
1318 host names only.
1320 @item @code{tramp-parse-passwd}
1321 @findex tramp-parse-passwd
1323 A function which parses @file{/etc/passwd} like files.  Obviously, it
1324 can return user names only.
1326 @item @code{tramp-parse-netrc}
1327 @findex tramp-parse-netrc
1329 Finally, a function which parses @file{~/.netrc} like files.
1330 @end table
1332 If you want to keep your own data in a file, with your own structure,
1333 you might provide such a function as well.  This function must meet
1334 the following conventions:
1336 @defun my-tramp-parse file
1337 @var{file} must be either a file name on your host, or @code{nil}. The
1338 function must return a list of (@var{user} @var{host}), which are
1339 taken as candidates for user and host name completion.
1341 Example:
1342 @example
1343 (my-tramp-parse "~/.my-tramp-hosts")
1345      @result{} ((nil "toto") ("daniel" "melancholia"))
1346 @end example
1347 @end defun
1350 @node Remote Programs
1351 @section How @tramp{} finds and uses programs on the remote machine.
1353 @tramp{} depends on a number of programs on the remote host in order to
1354 function, including @command{ls}, @command{test}, @command{find} and
1355 @command{cat}.
1357 In addition to these required tools, there are various tools that may be
1358 required based on the connection method. See @ref{Inline methods} and
1359 @ref{External transfer methods} for details on these.
1361 Certain other tools, such as @command{perl} (or @command{perl5}) and
1362 @command{grep} will be used if they can be found. When they are
1363 available, they are used to improve the performance and accuracy of
1364 remote file access.
1366 @vindex tramp-remote-path
1367 When @tramp{} connects to the remote machine, it searches for the
1368 programs that it can use. The variable @var{tramp-remote-path} controls
1369 the directories searched on the remote machine.
1371 By default, this is set to a reasonable set of defaults for most
1372 machines. It is possible, however, that your local (or remote ;) system
1373 administrator has put the tools you want in some obscure local
1374 directory.
1376 In this case, you can still use them with @tramp{}. You simply need to
1377 add code to your @file{.emacs} to add the directory to the remote path.
1378 This will then be searched by @tramp{} when you connect and the software
1379 found.
1381 To add a directory to the remote search path, you could use code such
1384 @lisp
1385 @i{;; We load @tramp{} to define the variable.}
1386 (require 'tramp)
1387 @i{;; We have @command{perl} in "/usr/local/perl/bin"}
1388 (add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1389 @end lisp
1392 @node Remote shell setup
1393 @comment  node-name,  next,  previous,  up
1394 @section Remote shell setup hints
1395 @cindex remote shell setup
1396 @cindex @file{.profile} file
1397 @cindex @file{.login} file
1398 @cindex shell init files
1400 As explained in the @ref{Overview} section, @tramp{} connects to the
1401 remote host and talks to the shell it finds there.  Of course, when you
1402 log in, the shell executes its init files.  Suppose your init file
1403 requires you to enter the birth date of your mother; clearly @tramp{}
1404 does not know this and hence fails to log you in to that host.
1406 There are different possible strategies for pursuing this problem.  One
1407 strategy is to enable @tramp{} to deal with all possible situations.
1408 This is a losing battle, since it is not possible to deal with
1409 @emph{all} situations.  The other strategy is to require you to set up
1410 the remote host such that it behaves like @tramp{} expect.  This might
1411 be inconvenient because you have to invest a lot of effort into shell
1412 setup before you can begin to use @tramp{}.
1414 The package, therefore, pursues a combined approach.  It tries to figure
1415 out some of the more common setups, and only requires you to avoid
1416 really exotic stuff.  For example, it looks through a list of
1417 directories to find some programs on the remote host.  And also, it
1418 knows that it is not obvious how to check whether a file exists, and
1419 therefore it tries different possibilities.  (On some hosts and shells,
1420 the command @code{test -e} does the trick, on some hosts the shell
1421 builtin doesn't work but the program @code{/usr/bin/test -e} or
1422 @code{/bin/test -e} works.  And on still other hosts, @code{ls -d} is
1423 the right way to do this.)
1425 Below you find a discussion of a few things that @tramp{} does not deal
1426 with, and that you therefore have to set up correctly.
1428 @table @asis
1429 @item @var{shell-prompt-pattern}
1430 @vindex shell-prompt-pattern
1432 After logging in to the remote host, @tramp{} has to wait for the remote
1433 shell startup to finish before it can send commands to the remote
1434 shell.  The strategy here is to wait for the shell prompt.  In order to
1435 recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1436 to be set correctly to recognize the shell prompt on the remote host.
1438 Note that @tramp{} requires the match for @code{shell-prompt-pattern}
1439 to be at the end of the buffer.  Many people have something like the
1440 following as the value for the variable: @code{"^[^>$][>$] *"}.  Now
1441 suppose your shell prompt is @code{a <b> c $ }.  In this case,
1442 @tramp{} recognizes the @code{>} character as the end of the prompt,
1443 but it is not at the end of the buffer.
1445 @item @var{tramp-shell-prompt-pattern}
1446 @vindex tramp-shell-prompt-pattern
1448 This regular expression is used by @tramp{} in the same way as
1449 @code{shell-prompt-pattern}, to match prompts from the remote shell.
1450 This second variable exists because the prompt from the remote shell
1451 might be different from the prompt from a local shell --- after all,
1452 the whole point of @tramp{} is to log in to remote hosts as a
1453 different user.  The default value of
1454 @code{tramp-shell-prompt-pattern} is the same as the default value of
1455 @code{shell-prompt-pattern}, which is reported to work well in many
1456 circumstances.
1458 @item @code{tset} and other questions
1459 @cindex Unix command tset
1460 @cindex tset Unix command
1462 Some people invoke the @code{tset} program from their shell startup
1463 scripts which asks the user about the terminal type of the shell.
1464 Maybe some shells ask other questions when they are started.  @tramp{}
1465 does not know how to answer these questions.  There are two approaches
1466 for dealing with this problem.  One approach is to take care that the
1467 shell does not ask any questions when invoked from @tramp{}.  You can
1468 do this by checking the @code{TERM} environment variable, it will be
1469 set to @code{dumb} when connecting.
1471 @vindex tramp-terminal-type
1472 The variable @code{tramp-terminal-type} can be used to change this value
1473 to @code{dumb}.
1475 The other approach is to teach @tramp{} about these questions.  See
1476 the variables @code{tramp-actions-before-shell} and
1477 @code{tramp-multi-actions} (for multi-hop connections).
1479 @end table
1482 @node Auto-save and Backup
1483 @section Auto-save and Backup configuration
1484 @cindex auto-save
1485 @cindex backup
1486 @vindex backup-directory-alist
1488 Explaining auto-save is still to do.
1490 Normally, Emacs writes backup files to the same directory as the
1491 original files, but this behavior can be changed via the variable
1492 @code{backup-directory-alist}.  In connection with @tramp{}, this can
1493 have unexpected side effects.  Suppose that you specify that all backups
1494 should go to the directory @file{~/.emacs.d/backups/}, and then you edit
1495 the file @file{/su:root@@localhost:/etc/secretfile}.  The effect is that
1496 the backup file will be owned by you and not by root, thus possibly
1497 enabling others to see it even if they were not intended to see it.
1499 When @code{backup-directory-alist} is nil (the default), such problems
1500 do not occur.
1502 If you wish to customize the variable, the workaround is to include
1503 special settings for Tramp files.  For example, the following statement
1504 effectively `turns off' the effect of @code{backup-directory-alist} for
1505 @tramp{} files:
1507 @lisp
1508 (require 'tramp)
1509 (add-to-list 'backup-directory-alist
1510              (cons tramp-file-name-regexp nil))
1511 @end lisp
1514 @node Windows setup hints
1515 @section Issues with Cygwin ssh
1516 @cindex Cygwin, issues
1518 This section needs a lot of work!  Please help.
1520 @cindex method sshx with Cygwin
1521 @cindex sshx method with Cygwin
1522 If you use the Cygwin installation of ssh (you have to explicitly select
1523 it in the installer), then it should work out of the box to just select
1524 @code{sshx} as the connection method.  You can find information about
1525 setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}.
1527 @cindex method scpx with Cygwin
1528 @cindex scpx method with Cygwin
1529 If you wish to use the @code{scpx} connection method, then you might
1530 have the problem that Emacs calls @code{scp} with a Windows filename
1531 such as @code{c:/foo}.  The Cygwin version of @code{scp} does not know
1532 about Windows filenames and interprets this as a remote filename on the
1533 host @code{c}.
1535 One possible workaround is to write a wrapper script for @code{scp}
1536 which converts the Windows filename to a Cygwinized filename.
1538 I guess that another workaround is to run Emacs under Cygwin, or to run
1539 a Cygwinized Emacs.
1541 @cindex Cygwin and ssh-agent
1542 @cindex SSH_AUTH_SOCK and Emacs on Windows
1543 If you want to use either @code{ssh} based method on Windows, then you
1544 might encounter problems with @code{ssh-agent}.  Using this program,
1545 you can avoid typing the pass-phrase every time you log in (and the
1546 @code{scpx} method more or less requires you to use @code{ssh-agent}
1547 because it does not allow you to type a password or pass-phrase).
1548 However, if you start Emacs from a desktop shortcut, then the
1549 environment variable @code{SSH_AUTH_SOCK} is not set and so Emacs and
1550 thus @tramp{} and thus @code{ssh} and @code{scp} started from @tramp{}
1551 cannot communicate with @code{ssh-agent}.  It works better to start
1552 Emacs from the shell.
1554 If anyone knows how to start @code{ssh-agent} under Windows in such a
1555 way that desktop shortcuts can profit, please holler.  I don't really
1556 know anything at all about Windows@dots{}
1559 @node Usage
1560 @chapter Using @tramp
1561 @cindex using @tramp
1563 Once you have installed @tramp{} it will operate fairly transparently. You
1564 will be able to access files on any remote machine that you can log in
1565 to as though they were local.
1567 Files are specified to @tramp{} using a formalized syntax specifying the
1568 details of the system to connect to.  This is similar to the syntax used
1569 by the @value{ftp-package-name} package.
1571 @cindex type-ahead
1572 Something that might happen which surprises you is that Emacs
1573 remembers all your keystrokes, so if you see a password prompt from
1574 Emacs, say, and hit @kbd{@key{RET}} twice instead of once, then the
1575 second keystroke will be processed by Emacs after @tramp{} has done
1576 its thing.  Why, this type-ahead is normal behavior, you say.  Right
1577 you are, but be aware that opening a remote file might take quite a
1578 while, maybe half a minute when a connection needs to be opened.
1579 Maybe after half a minute you have already forgotten that you hit that
1580 key!
1582 @menu
1583 * Filename Syntax::             @tramp{} filename conventions.
1584 * Multi-hop filename syntax::   Multi-hop filename conventions.
1585 * Filename completion::         Filename completion.
1586 * Dired::                       Dired.
1587 @end menu
1590 @node Filename Syntax
1591 @section @tramp{} filename conventions
1592 @cindex filename syntax
1593 @cindex filename examples
1595 To access the file @var{localname} on the remote machine @var{machine} you
1596 would specify the filename
1597 @file{@value{tramp-prefix}@var{machine}@value{tramp-postfix}@var{localname}}.
1598 This will connect to @var{machine} and transfer the file using the
1599 default method.  @xref{Default Method}.
1601 Some examples of @tramp{} filenames are shown below.
1603 @table @file
1604 @item @value{tramp-prefix}melancholia@value{tramp-postfix}.emacs
1605 Edit the file @file{.emacs} in your home directory on the machine
1606 @code{melancholia}.
1608 @item @value{tramp-prefix}melancholia.danann.net@value{tramp-postfix}.emacs
1609 This edits the same file, using the fully qualified domain name of
1610 the machine.
1612 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~/.emacs
1613 This also edits the same file --- the @file{~} is expanded to your
1614 home directory on the remote machine, just like it is locally.
1616 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~daniel/.emacs
1617 This edits the file @file{.emacs} in the home directory of the user
1618 @code{daniel} on the machine @code{melancholia}. The @file{~<user>}
1619 construct is expanded to the home directory of that user on the remote
1620 machine.
1622 @item @value{tramp-prefix}melancholia@value{tramp-postfix}/etc/squid.conf
1623 This edits the file @file{/etc/squid.conf} on the machine
1624 @code{melancholia}.
1626 @end table
1628 Unless you specify a different name to use, @tramp{} will use the
1629 current local user name as the remote user name to log in with. If you
1630 need to log in as a different user, you can specify the user name as
1631 part of the filename.
1633 To log in to the remote machine as a specific user, you use the syntax
1634 @file{@value{tramp-prefix}@var{user}@@@var{machine}@value{tramp-postfix}/@var{path/to.file}}.
1635 That means that connecting to @code{melancholia} as @code{daniel} and
1636 editing @file{.emacs} in your home directory you would specify
1637 @file{@value{tramp-prefix}daniel@@melancholia@value{tramp-postfix}.emacs}.
1639 It is also possible to specify other file transfer methods
1640 (@pxref{Default Method}) as part of the filename.
1641 @ifset emacs
1642 This is done by putting the method before the user and host name, as
1644 @file{@value{tramp-prefix}@var{method}@value{tramp-postfix-single-hop}}
1645 (Note the trailing colon).
1646 @end ifset
1647 @ifset xemacs
1648 This is done by replacing the initial
1649 @file{@value{tramp-prefix}} with
1650 @file{@value{tramp-prefix}<method>@value{tramp-postfix-single-hop}}.
1651 (Note the trailing slash!).
1652 @end ifset
1653 The user, machine and file specification remain the same.
1655 So, to connect to the machine @code{melancholia} as @code{daniel},
1656 using the @option{su} method to transfer files, and edit @file{.emacs}
1657 in my home directory I would specify the filename
1658 @file{@value{tramp-prefix}su@value{tramp-postfix-single-hop}daniel@@melancholia@value{tramp-postfix}.emacs}.
1661 @node Multi-hop filename syntax
1662 @section Multi-hop filename conventions
1663 @cindex filename syntax for multi-hop files
1664 @cindex multi-hop filename syntax
1666 The syntax of multi-hop file names is necessarily slightly different
1667 than the syntax of other @tramp{} file names.  Here's an example
1668 multi-hop file name, first in Emacs syntax and then in XEmacs syntax:
1670 @example
1671 @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
1672 @end example
1674 This is quite a mouthful.  So let's go through it step by step.  The
1675 file name consists of three parts.
1676 @ifset emacs
1677 The parts are separated by colons
1678 @end ifset
1679 @ifset xemacs
1680 The parts are separated by slashes and square brackets.
1681 @end ifset
1682 The first part is @file{@value{tramp-prefix}multi}, the method
1683 specification.  The second part is
1684 @file{rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host}
1685 and specifies the hops.  The final part is @file{/path/to.file} and
1686 specifies the file name on the remote host.
1688 The first part and the final part should be clear.  See @ref{Multi-hop
1689 Methods}, for a list of alternatives for the method specification.
1691 The second part can be subdivided again into components, so-called
1692 hops.  In the above file name, there are two hops,
1693 @file{rsh@value{tramp-postfix-multi-hop}out@@gate} and
1694 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}.
1696 Each hop can @emph{again} be subdivided into (three) components, the
1697 @dfn{hop method}, the @dfn{user name} and the @dfn{host name}.  The
1698 meaning of the second and third component should be clear, and the hop
1699 method says what program to use to perform that hop.
1701 The first hop, @file{rsh@value{tramp-postfix-multi-hop}out@@gate},
1702 says to use @command{rsh} to log in as user @code{out} to the host
1703 @code{gate}.  Starting at that host, the second hop,
1704 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}, says to
1705 use @command{telnet} to log in as user @code{kai} to host
1706 @code{real.host}.
1708 @xref{Multi-hop Methods}, for a list of possible hop method values.
1709 The variable @code{tramp-multi-connection-function-alist} contains the
1710 list of possible hop methods and information on how to execute them,
1711 should you want to add your own.
1714 @node Filename completion
1715 @section Filename completion
1716 @cindex filename completion
1718 Filename completion works with @tramp{} for both completing methods,
1719 user names and machine names (except multi hop methods) as well as for
1720 files on remote machines.
1722 If you, for example, type @kbd{C-x C-f @value{tramp-prefix}t
1723 @key{TAB}}, @tramp{} might give you as result the choice for
1725 @example
1726 @ifset emacs
1727 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}                              tmp/
1728 @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1729 @end ifset
1730 @ifset xemacs
1731 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}                              @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1732 @end ifset
1733 @end example
1735 @samp{@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}}
1736 is a possible completion for the respective method,
1737 @ifset emacs
1738 @samp{tmp/} stands for the directory @file{/tmp} on your local
1739 machine,
1740 @end ifset
1741 and @samp{@value{tramp-prefix-single-hop}toto@value{tramp-postfix}}
1742 might be a host @tramp has detected in your @file{~/.ssh/known_hosts}
1743 file (given you're using default method @option{ssh}).
1745 If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
1746 @samp{@value{tramp-prefix}telnet@value{tramp-postfix-single-hop}}.
1747 Next @kbd{@key{TAB}} brings you all machine names @tramp{} detects in
1748 your @file{/etc/hosts} file, let's say
1750 @example
1751 @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}
1752 @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}
1753 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia@value{tramp-postfix}
1754 @end example
1756 Now you can choose the desired machine, and you can continue to
1757 complete file names on that machine.
1759 As filename completion needs to fetch the listing of files from the
1760 remote machine, this feature is sometimes fairly slow.  As @tramp{}
1761 does not yet cache the results of directory listing, there is no gain
1762 in performance the second time you complete filenames.
1764 If the configuration files (@pxref{Customizing Completion}), which
1765 @tramp{} uses for analysis of completion, offer user names, those user
1766 names will be taken into account as well.
1769 @node Dired
1770 @section Dired
1771 @cindex dired
1773 @tramp{} works transparently with dired, enabling you to use this powerful
1774 file management tool to manage files on any machine you have access to
1775 over the Internet.
1777 If you need to browse a directory tree, Dired is a better choice, at
1778 present, than filename completion.  Dired has its own cache mechanism
1779 and will only fetch the directory listing once.
1782 @node Bug Reports
1783 @chapter Reporting Bugs and Problems
1784 @cindex bug reports
1786 Bugs and problems with @tramp{} are actively worked on by the development
1787 team. Feature requests and suggestions are also more than welcome.
1789 The @tramp{} mailing list is a great place to get information on working
1790 with @tramp{}, solving problems and general discussion and advice on topics
1791 relating to the package.
1793 The  mailing list is at @email{tramp-devel@@mail.freesoftware.fsf.org}.
1794 Messages sent to this address go to all the subscribers. This is
1795 @emph{not} the address to send subscription requests to.
1797 For help on subscribing to the list, send mail to the administrative
1798 address, @email{tramp-devel-request@@mail.freesoftware.fsf.org}, with the
1799 subject @samp{help}.
1801 To report a bug in @tramp{}, you should execute @kbd{M-x tramp-bug}. This
1802 will automatically generate a buffer with the details of your system and
1803 @tramp{} version.
1805 When submitting a bug report, please try to describe in excruciating
1806 detail the steps required to reproduce the problem, the setup of the
1807 remote machine and any special conditions that exist.
1809 If you can identify a minimal test case that reproduces the problem,
1810 include that with your bug report. This will make it much easier for the
1811 development team to analyze and correct the problem.
1813 @node Frequently Asked Questions
1814 @chapter Frequently Asked Questions
1815 @cindex frequently asked questions
1816 @cindex FAQ
1818 @itemize @bullet
1819 @item
1820 Where can I get the latest @tramp{}?
1822 @tramp{} is available under the URL below.
1824 @noindent
1825 @uref{http://savannah.nongnu.org/download/tramp/}
1827 @noindent
1828 There is also a Savannah project page.
1830 @noindent
1831 @uref{https://savannah.gnu.org/projects/tramp/}
1833 @item
1834 Which systems does it work on?
1836 The package has been used successfully on Emacs 20 and Emacs 21, as well
1837 as XEmacs 21.  XEmacs 20 is more problematic, see the notes in
1838 @file{tramp.el}.  I don't think anybody has really tried it on Emacs 19.
1840 The package was intended to work on Unix, and it really expects a
1841 Unix-like system on the remote end, but some people seemed to have some
1842 success getting it to work on NT Emacs.
1844 There is some informations on @tramp{} on NT at the following URL;
1845 many thanks to Joe Stoy for providing the information:
1846 @uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}
1848 The above mostly contains patches to old ssh versions; Tom Roche has a
1849 Web page with instructions:
1850 @uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
1852 ??? Is the XEmacs info correct?
1854 ??? Can somebody provide some information for getting it to work on NT
1855 Emacs?  I think there was some issue with @command{ssh}?
1858 @item
1859 I can't stop @value{ftp-package-name} starting with @value{emacs-name}
1861 @ifset emacs
1862 @value{ftp-package-name} is loaded from @tramp{} automatically if you
1863 require a file by the ftp method.  Unfortunately, there are some Lisp
1864 packages which make @value{ftp-package-name} file name handlers active.
1865 You can see it applying @kbd{C-h v file-name-handler-alist}:
1867 @example
1868 file-name-handler-alist's value is 
1869 (("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
1870  ("^/[^/:]*[^/:.]:" . ange-ftp-hook-function)
1871  ("^/[^/]*$" . tramp-completion-file-name-handler)
1872  ("\\`/[^/:]+:" . tramp-file-name-handler)
1873  ("\\`/:" . file-name-non-special))
1874 @end example
1876 Please try to find out which package is responsible for loading
1877 @value{ftp-package-name}, and raise a bug report.
1879 A workaround is to require @value{ftp-package-name} before @tramp{} in
1880 your @file{~/.emacs}, because @tramp{} cleans up the entries in
1881 @code{file-name-handler-alist}:
1883 @lisp
1884 ;; @value{ftp-package-name} temporarily required
1885 (require 'ange-ftp)
1886 ;; @tramp{} cleans up @code{file-name-handler-alist}
1887 (require 'tramp)
1888 @end lisp
1889 @end ifset
1891 @ifset xemacs
1892 Not all the older versions of @tramp{} supported @value{emacs-name}
1893 correctly.  The first thing to do is to make sure that you have the
1894 latest version of @tramp{} installed.
1896 If you do, please try and find out exactly the conditions required for
1897 the @value{ftp-package-name} handlers to fire.  If you can, putting a
1898 breakpoint on @code{efs-ftp-path} and sending in the stack trace along
1899 with your bug report would make it easier for the developers to work out
1900 what is going wrong.
1901 @end ifset
1904 @item
1905 File name completion does not work with @tramp{}
1907 When you log in to the remote machine, do you see the output of
1908 @command{ls} in color? If so, this may be the cause of your problems.
1910 @command{ls} outputs @acronym{ANSI} escape sequences that your terminal
1911 emulator interprets to set the colors.  These escape sequences will
1912 confuse @tramp{} however.
1914 In your @file{.bashrc}, @file{.profile} or equivalent on the remote
1915 machine you probably have an alias configured that adds the option
1916 @option{--color=yes} or @option{--color=auto}.
1918 You should remove that alias and ensure that a new login @emph{does not}
1919 display the output of @command{ls} in color.  If you still cannot use
1920 filename completion, report a bug to the @tramp{} developers.
1923 @item
1924 File name completion does not work in large directories
1926 @tramp{} uses globbing for some operations.  (Globbing means to use the
1927 shell to expand wildcards such as `*.c'.)  This might create long
1928 command lines, especially in directories with many files.  Some shells
1929 choke on long command lines, or don't cope well with the globbing
1930 itself.
1932 If you have a large directory on the remote end, you may wish to execute
1933 a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
1934 Note that you must first start the right shell, which might be
1935 @command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
1936 of those supports tilde expansion.
1939 @item
1940 What kinds of systems does @tramp{} work on
1942 @tramp{} really expects the remote system to be a Unix-like system.  The
1943 local system should preferably be Unix-like, as well, but @tramp{} might
1944 work on NT with some tweaking.
1947 @item
1948 How can I get notified when @tramp{} file transfers are complete?
1950 The following snippet can be put in your @file{~/.emacs} file.  It makes
1951 Emacs beep after reading from or writing to the remote host.
1953 @lisp
1954 (defadvice tramp-handle-write-region
1955   (after tramp-write-beep-advice activate)
1956  " make tramp beep after writing a file."
1957  (interactive)
1958  (beep))
1959 (defadvice tramp-handle-do-copy-or-rename-file
1960   (after tramp-copy-beep-advice activate)
1961  " make tramp beep after copying a file."
1962  (interactive)
1963  (beep))
1964 (defadvice tramp-handle-insert-file-contents
1965   (after tramp-copy-beep-advice activate)
1966  " make tramp beep after copying a file."
1967  (interactive)
1968  (beep))
1969 @end lisp
1972 @item
1973 There's this @file{~/.sh_history} file on the remote host which keeps
1974 growing and growing.  What's that?
1976 Sometimes, @tramp{} starts @code{ksh} on the remote host for tilde
1977 expansion.  Maybe @code{ksh} saves the history by default.  @tramp{}
1978 tries to turn off saving the history, but maybe you have to help.  For
1979 example, you could put this in your @file{.kshrc}:
1981 @example
1982 if [ -f $HOME/.sh_history ] ; then
1983    /bin/rm $HOME/.sh_history
1985 if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
1986    unset HISTFILE
1988 if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
1989    unset HISTSIZE
1991 @end example
1994 @item @tramp{} doesn't transfer strings with more than 500 characters
1995 correctly
1997 On some few systems, the implementation of @code{process-send-string}
1998 seems to be broken for longer strings.  This case, you should
1999 customize the variable @code{tramp-chunksize} to 500.  For a
2000 description how to determine whether this is necessary see the
2001 documentation of @code{tramp-chunksize}.
2003 @end itemize
2006 @c For the developer
2007 @node Version Control
2008 @chapter The inner workings of remote version control
2010 Unlike @value{ftp-package-name}, @tramp{} has full shell access to the
2011 remote machine. This makes it possible to provide version control for
2012 files accessed under @tramp{}.
2014 The actual version control binaries must be installed on the remote
2015 machine, accessible in the directories specified in
2016 @var{tramp-remote-path}.
2018 This transparent integration with the version control systems is one of
2019 the most valuable features provided by @tramp{}, but it is far from perfect.
2020 Work is ongoing to improve the transparency of the system.
2022 @menu
2023 * Version Controlled Files::    Determining if a file is under version control.
2024 * Remote Commands::             Executing the version control commands on the remote machine.
2025 * Changed workfiles::           Detecting if the working file has changed.
2026 * Checking out files::          Bringing the workfile out of the repository.
2027 * Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
2028 @end menu
2031 @node Version Controlled Files
2032 @section Determining if a file is under version control
2034 The VC package uses the existence of on-disk revision control master
2035 files to determine if a given file is under revision control. These file
2036 tests happen on the remote machine through the standard @tramp{} mechanisms.
2039 @node Remote Commands
2040 @section Executing the version control commands on the remote machine
2042 There are no hooks provided by VC to allow intercepting of the version
2043 control command execution. The calls occur through the
2044 @code{call-process} mechanism, a function that is somewhat more
2045 efficient than the @code{shell-command} function but that does not
2046 provide hooks for remote execution of commands.
2048 To work around this, the functions @code{vc-do-command} and
2049 @code{vc-simple-command} have been advised to intercept requests for
2050 operations on files accessed via @tramp{}.
2052 In the case of a remote file, the @code{shell-command} interface is
2053 used, with some wrapper code, to provide the same functionality on the
2054 remote machine as would be seen on the local machine. 
2057 @node Changed workfiles
2058 @section Detecting if the working file has changed
2060 As there is currently no way to get access to the mtime of a file on a
2061 remote machine in a portable way, the @code{vc-workfile-unchanged-p}
2062 function is advised to call an @tramp{} specific function for remote files.
2064 The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
2065 diff functionality to determine if any changes have occurred between the
2066 workfile and the version control master.
2068 This requires that a shell command be executed remotely, a process that
2069 is notably heavier-weight than the mtime comparison used for local
2070 files. Unfortunately, unless a portable solution to the issue is found,
2071 this will remain the cost of remote version control.
2074 @node Checking out files
2075 @section Bringing the workfile out of the repository
2077 VC will, by default, check for remote files and refuse to act on them
2078 when checking out files from the repository. To work around this
2079 problem, the function @code{vc-checkout} knows about @tramp{} files and
2080 allows version control to occur.
2083 @node Miscellaneous Version Control
2084 @section Things related to Version Control that don't fit elsewhere
2086 Minor implementation details, &c.
2088 @menu
2089 * Remote File Ownership::       How VC determines who owns a workfile.
2090 * Back-end Versions::           How VC determines what release your RCS is.
2091 @end menu
2094 @node Remote File Ownership
2095 @subsection How VC determines who owns a workfile
2097 Emacs provides the @code{user-full-name} function to return the login name
2098 of the current user as well as mapping from arbitrary user id values
2099 back to login names. The VC code uses this functionality to map from the
2100 uid of the owner of a workfile to the login name in some circumstances.
2102 This will not, for obvious reasons, work if the remote system has a
2103 different set of logins. As such, it is necessary to delegate to the
2104 remote machine the job of determining the login name associated with a
2105 uid.
2107 Unfortunately, with the profusion of distributed management systems such
2108 as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
2109 reliable and portable method for performing this mapping.
2111 Thankfully, the only place in the VC code that depends on the mapping of
2112 a uid to a login name is the @code{vc-file-owner} function. This returns
2113 the login of the owner of the file as a string.
2115 This function has been advised to use the output of @command{ls} on the
2116 remote machine to determine the login name, delegating the problem of
2117 mapping the uid to the login to the remote system which should know more
2118 about it than I do.
2121 @node Back-end Versions
2122 @subsection How VC determines what release your RCS is
2124 VC needs to know what release your revision control binaries you are
2125 running as not all features VC supports are available with older
2126 versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.
2128 The default implementation of VC determines this value the first time it
2129 is needed and then stores the value globally to avoid the overhead of
2130 executing a process and parsing its output each time the information is
2131 needed.
2133 Unfortunately, life is not quite so easy when remote version control
2134 comes into the picture. Each remote machine may have a different version
2135 of the version control tools and, while this is painful, we need to
2136 ensure that unavailable features are not used remotely.
2138 To resolve this issue, @tramp{} currently takes the sledgehammer
2139 approach of making the release values of the revision control tools
2140 local to each @tramp{} buffer, forcing VC to determine these values
2141 again each time a new file is visited.
2143 This has, quite obviously, some performance implications. Thankfully,
2144 most of the common operations performed by VC do not actually require
2145 that the remote version be known. This makes the problem far less
2146 apparent.
2148 Eventually these values will be captured by @tramp{} on a system by
2149 system basis and the results cached to improve performance.
2152 @node Files directories and localnames
2153 @chapter How file names, directories and localnames are mangled and managed.
2155 @menu
2156 * Localname deconstruction::    Breaking a localname into its components.
2157 @end menu
2160 @node Localname deconstruction
2161 @section Breaking a localname into its components.
2163 @tramp{} file names are somewhat different, obviously, to ordinary file
2164 names. As such, the lisp functions @code{file-name-directory} and
2165 @code{file-name-nondirectory} are overridden within the @tramp{}
2166 package.
2168 Their replacements are reasonably simplistic in their approach. They
2169 dissect the filename, call the original handler on the localname and
2170 then rebuild the @tramp{} file name with the result.
2172 This allows the platform specific hacks in the original handlers to take
2173 effect while preserving the @tramp{} file name information.
2176 @node Issues
2177 @chapter Debatable Issues and What Was Decided
2179 @itemize @bullet
2180 @item The uuencode method does not always work.
2182 Due to the design of @tramp{}, the encoding and decoding programs need to
2183 read from stdin and write to stdout.  On some systems, @code{uudecode -o
2184 -} will read stdin and write the decoded file to stdout, on other
2185 systems @code{uudecode -p} does the same thing.  But some systems have
2186 uudecode implementations which cannot do this at all---it is not
2187 possible to call these uudecode implementations with suitable parameters
2188 so that they write to stdout.
2190 Of course, this could be circumvented: the @code{begin foo 644} line
2191 could be rewritten to put in some temporary file name, then
2192 @code{uudecode} could be called, then the temp file could be printed and
2193 deleted.
2195 But I have decided that this is too fragile to reliably work, so on some
2196 systems you'll have to do without the uuencode methods.
2198 @item @tramp{} does not work on XEmacs 20.
2200 This is because it requires the macro @code{with-timeout} which does not
2201 appear to exist in XEmacs 20.  I'm somewhat reluctant to add an
2202 emulation macro to @tramp{}, but if somebody who uses XEmacs 20 steps
2203 forward and wishes to implement and test it, please contact me or the
2204 mailing list.
2206 @item The @tramp{} filename syntax differs between Emacs and XEmacs.
2208 The Emacs maintainers wish to use a unified filename syntax for
2209 Ange-FTP and @tramp{} so that users don't have to learn a new
2210 syntax.  It is sufficient to learn some extensions to the old syntax.
2212 For the XEmacs maintainers, the problems caused from using a unified
2213 filename syntax are greater than the gains.  The XEmacs package system
2214 uses EFS for downloading new packages.  So, obviously, EFS has to be
2215 installed from the start.  If the filenames were unified, @tramp{}
2216 would have to be installed from the start, too.
2218 @end itemize
2221 @c End of tramp.texi - the TRAMP User Manual
2222 @bye
2224 @c TODO
2226 @c * Say something about the .login and .profile files of the remote
2227 @c   shells.
2228 @c * Explain how tramp.el works in principle: open a shell on a remote
2229 @c   host and then send commands to it.
2230 @c * Mention that bookmarks are a cool feature to go along with Tramp.
2231 @c * Make terminology "inline" vs "out-of-band" consistent.
2232 @c   It seems that "external" is also used instead of "out-of-band".
2234 @c * M. Albinus
2235 @c ** Use `filename' resp. `file name' consistently.
2236 @c ** Use `host' resp. `machine' consistently.
2237 @c ** Consistent small or capitalized words especially in menues.