Version 2.0.35 of Tramp released.
[emacs.git] / man / tramp.texi
blob49e10c9e58165d6114a588be908c2fc220eb1fff
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.
15 @c Additionally, flags are set with respect to the Emacs flavor; and
16 @c depending whether Tramp is packaged into (X)Emacs, or standalone.
18 @include trampver.texi
20 @c Macro to make formatting of the tramp program name consistent.
21 @macro tramp
22 @sc{tramp}
23 @end macro
25 @c Macros for formatting a filename.
26 @c trampfn is for a full filename, trampfnmhp means method, host, localname
27 @c were given, and so on.
28 @macro trampfn(method, user, host, localname)
29 @value{tramp-prefix}@value{method}@value{user}@@@value{host}@value{tramp-postfix}@value{localname}
30 @end macro
32 @copying
33 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003 Free Software
34 Foundation, Inc.
36 @quotation     
37 Permission is granted to copy, distribute and/or modify this document
38 under the terms of the GNU Free Documentation License, Version 1.1 or
39 any later version published by the Free Software Foundation; with no
40 Invariant Sections, with the Front-Cover texts being ``A GNU
41 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
42 license is included in the section entitled ``GNU Free Documentation
43 License'' in the Emacs manual.
45 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
46 this GNU Manual, like GNU software.  Copies published by the Free
47 Software Foundation raise funds for GNU development.''
49 This document is part of a collection distributed under the GNU Free
50 Documentation License.  If you want to distribute this document
51 separately from the collection, you can do so by adding a copy of the
52 license to the document, as described in section 6 of the license.
53 @end quotation
54 @end copying
56 @c Entries for @command{install-info} to use
57 @dircategory Emacs
58 @direntry
59 * TRAMP: (tramp).                Transparent Remote Access, Multiple Protocol
60                                  Emacs remote file access via rsh and rcp.
61 @end direntry
63 @tex
65 @titlepage
66 @title @tramp{} version @trampver{} User Manual
68 @author by Daniel Pittman
69 @author based on documentation by Kai Gro@ss{}johann
71 @page
72 @insertcopying
74 @end titlepage
75 @page
77 @end tex
79 @ifnottex
80 @node Top, Overview, (dir), (dir)
81 @top @tramp{} version @trampver{} User Manual
83 This file documents @tramp{} version @trampver{}, a remote file
84 editing package for @value{emacs-name}.
86 @tramp{} stands for `Transparent Remote (file) Access, Multiple
87 Protocol'.  This package provides remote file editing, similar to
88 @value{ftp-package-name}.
90 The difference is that @value{ftp-package-name} uses FTP to transfer
91 files between the local and the remote host, whereas @tramp{} uses a
92 combination of @command{rsh} and @command{rcp} or other work-alike
93 programs, such as @command{ssh}/@command{scp}.
95 You can find the latest version of this document on the web at
96 @uref{http://www.freesoftware.fsf.org/tramp/}.
98 @c Pointer to the other Emacs flavor is necessary only in case of
99 @c standalone installation.  Text taken from trampinst.texi.
100 @ifset tramp-inst
101 @otherflavor{}
102 @end ifset
104 @ifhtml
105 This manual is also available as a @uref{tramp_ja.html, Japanese
106 translation}.
108 The latest release of @tramp{} is available for
109 @uref{http://savannah.gnu.org/download/tramp/,
110 download}, or you may see @ref{Obtaining @tramp{}} for more details,
111 including the CVS server details.
113 @tramp{} also has a @uref{https://savannah.gnu.org/projects/tramp/,
114 Savannah Project Page}.
115 @end ifhtml
117 There is a mailing list for @tramp{}, available at
118 @email{tramp-devel@@mail.freesoftware.fsf.org}, and archived at
119 @uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/} as
120 well as the usual Savannah archives.
122 @insertcopying
124 @end ifnottex
126 @menu
127 * Overview::                    What @tramp{} can and cannot do.
129 For the end user:
131 * Obtaining @tramp{}::             How to obtain @tramp{}.
132 * History::                     History of @tramp{}.
133 @ifset tramp-inst
134 * Installation::                Installing @tramp{} with your @value{emacs-name}.
135 @end ifset
136 * Configuration::               Configuring @tramp{} for use.
137 * Usage::                       An overview of the operation of @tramp{}.
138 * Bug Reports::                 Reporting Bugs and Problems.
139 * Frequently Asked Questions::  Questions and answers from the mailing list.
140 * Concept Index::               An item for each concept
142 For the developer:
144 * Version Control::             The inner workings of remote version control.
145 * Files directories and localnames::  How file names, directories and localnames are mangled and managed.
146 * Issues::                      Debatable Issues and What Was Decided.
148 @detailmenu
149  --- The Detailed Node Listing ---
151 @ifset tramp-inst
152 Installing @tramp{} with your @value{emacs-name}
154 * Installation parameters::     Parameters in order to control installation.
155 * Load paths::                  How to plug-in @tramp{} into your environment.
157 @end ifset
159 Configuring @tramp{} for use
161 * Connection types::            Types of connections made to remote machines.
162 * Inline methods::              Inline methods.
163 * External transfer methods::   External transfer methods.
164 * Multi-hop Methods::           Connecting to a remote host using multiple hops.
165 * Default Method::              Selecting a default method.
166 * Customizing Methods::         Using Non-Standard Methods.
167 * Customizing Completion::      Selecting config files for user/host name completion.
168 * Remote Programs::             How @tramp{} finds and uses programs on the remote machine.
169 * Remote shell setup::          Remote shell setup hints.
170 * Windows setup hints::         Issues with Cygwin ssh.
171 * Auto-save and Backup::        Auto-save and Backup.
173 Using @tramp
175 * Filename Syntax::             @tramp{} filename conventions.
176 * Multi-hop filename syntax::   Multi-hop filename conventions.
177 * Filename completion::         Filename completion.
178 * Dired::                       Dired.
180 The inner workings of remote version control
182 * Version Controlled Files::    Determining if a file is under version control.
183 * Remote Commands::             Executing the version control commands on the remote machine.
184 * Changed workfiles::           Detecting if the working file has changed.
185 * Checking out files::          Bringing the workfile out of the repository.
186 * Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
188 Things related to Version Control that don't fit elsewhere
190 * Remote File Ownership::       How VC determines who owns a workfile.
191 * Back-end Versions::           How VC determines what release your RCS is.
193 How file names, directories and localnames are mangled and managed
195 * Localname deconstruction::    Breaking a localname into its components.
197 @end detailmenu
198 @end menu
200 @node Overview
201 @chapter An overview of @tramp
202 @cindex overview
204 After the installation of @tramp{} into your @value{emacs-name}, you
205 will be able to access files on remote machines as though they were
206 local.  Access to the remote file system for editing files, version
207 control, and @command{dired} are transparently enabled.
209 Your access to the remote machine can be with the @command{rsh},
210 @command{rlogin}, @command{telnet} programs or with any similar
211 connection method.  This connection must pass ASCII successfully to be
212 usable but need not be 8-bit clean.
214 The package provides support for @command{ssh} connections out of the
215 box, one of the more common uses of the package.  This allows
216 relatively secure access to machines, especially if @command{ftp}
217 access is disabled.
219 The majority of activity carried out by @tramp{} requires only that
220 the remote login is possible and is carried out at the terminal.  In
221 order to access remote files @tramp{} needs to transfer their content
222 to the local machine temporarily.
224 @tramp{} can transfer files between the machines in a variety of ways.
225 The details are easy to select, depending on your needs and the
226 machines in question.
228 The fastest transfer methods (for large files) rely on a remote file
229 transfer package such as @command{rcp}, @command{scp} or
230 @command{rsync}.  The use of these methods is only possible if the
231 file copy command does not ask for a password for the remote machine.
233 If the remote copy methods are not suitable for you, @tramp{} also
234 supports the use of encoded transfers directly through the shell.
235 This requires that the @command{mimencode} or @command{uuencode} tools
236 are available on the remote machine.  These methods are generally
237 faster for small files.
239 Within these limitations, @tramp{} is quite powerful.  It is worth
240 noting that, as of the time of writing, it is far from a polished
241 end-user product.  For a while yet you should expect to run into rough
242 edges and problems with the code now and then.
244 It is finished enough that the developers use it for day to day work but
245 the installation and setup can be a little difficult to master, as can
246 the terminology.
248 @tramp{} is still under active development and any problems you encounter,
249 trivial or major, should be reported to the @tramp{} developers.
250 @xref{Bug Reports}.
253 @subsubheading Behind the scenes
254 @cindex behind the scenes
255 @cindex details of operation
256 @cindex how it works
258 This section tries to explain what goes on behind the scenes when you
259 access a remote file through @tramp{}.
261 Suppose you type @kbd{C-x C-f} and enter part of an @tramp{} file name,
262 then hit @kbd{@key{TAB}} for completion.  Suppose further that this is
263 the first time that @tramp{} is invoked for the host in question.  Here's
264 what happens:
266 @itemize
267 @item
268 @tramp{} discovers that it needs a connection to the host.  So it
269 invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
270 @var{user}} or a similar tool to connect to the remote host.
271 Communication with this process happens through an
272 @value{emacs-name} buffer, that is, the output from the remote end
273 goes into a buffer.
275 @item
276 The remote host may prompt for a login name (for @command{telnet}).  The
277 login name is given in the file name, so @tramp{} sends the login name and
278 a newline.
280 @item
281 The remote host may prompt for a password or pass phrase (for
282 @command{rsh} or for @command{telnet} after sending the login name).
283 @tramp{} displays the prompt in the minibuffer, asking you for the
284 password or pass phrase.
286 You enter the password or pass phrase.  @tramp{} sends it to the remote
287 host, followed by a newline.
289 @item
290 @tramp{} now waits for the shell prompt or for a message that the login
291 failed.
293 If @tramp{} sees neither of them after a certain period of time (a minute,
294 say), then it issues an error message saying that it couldn't find the
295 remote shell prompt and shows you what the remote host has sent.
297 If @tramp{} sees a @samp{login failed} message, it tells you so,
298 aborts the login attempt and allows you to try again.
300 @item
301 Suppose that the login was successful and @tramp{} sees the shell prompt
302 from the remote host.  Now @tramp{} invokes @command{/bin/sh} because
303 Bourne shells and C shells have different command
304 syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
305 shell doesn't recognize @samp{exec /bin/sh} as a valid command.
306 Maybe you use the Scheme shell @command{scsh}@dots{}}
308 After the Bourne shell has come up, @tramp{} sends a few commands to
309 ensure a good working environment.  It turns off echoing, it sets the
310 shell prompt, and a few other things.
312 @item
313 Now the remote shell is up and it good working order.  Remember, what
314 was supposed to happen is that @tramp{} tries to find out what files exist
315 on the remote host so that it can do filename completion.
317 So, @tramp{} basically issues @command{cd} and @command{ls} commands and
318 also sometimes @command{echo} with globbing.  Another command that is
319 often used is @command{test} to find out whether a file is writable or a
320 directory or the like.  The output of each command is parsed for the
321 necessary operation.
323 @item
324 Suppose you are finished with filename completion, have entered @kbd{C-x
325 C-f}, a full file name and hit @kbd{@key{RET}}.  Now comes the time to
326 transfer the file contents from the remote host to the local host so
327 that you can edit them.
329 See above for an explanation of how @tramp{} transfers the file contents.
331 For inline transfers, @tramp{} issues a command like @samp{mimencode -b
332 /path/to/remote/file}, waits until the output has accumulated in the
333 buffer that's used for communication, then decodes that output to
334 produce the file contents.
336 For out-of-band transfers, @tramp{} issues a command like the following:
337 @example
338 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
339 @end example
340 It then reads the local temporary file @file{/tmp/tramp.4711} into a
341 buffer and deletes the temporary file.
343 @item
344 You now edit the buffer contents, blithely unaware of what has happened
345 behind the scenes.  (Unless you have read this section, that is.)  When
346 you are finished, you type @kbd{C-x C-s} to save the buffer.
348 @item
349 Again, @tramp{} transfers the file contents to the remote host either
350 inline or out-of-band.  This is the reverse of what happens when reading
351 the file.
353 @end itemize
355 I hope this has provided you with a basic overview of what happens
356 behind the scenes when you open a file with @tramp{}.
359 @c For the end user
360 @node Obtaining @tramp{}
361 @chapter Obtaining @tramp{}.
362 @cindex obtaining Tramp
364 @tramp{} is freely available on the Internet and the latest release
365 may be downloaded from
366 @uref{http://savannah.nongnu.org/download/tramp/}. This
367 release includes the full documentation and code for @tramp{},
368 suitable for installation.  But Emacs (21.4 or later) includes
369 @tramp{} already, and there is a @tramp{} package for XEmacs, as well.
370 So maybe it is easier to just use those.  But if you want the bleeding
371 edge, read on@dots{...}
373 For the especially brave, @tramp{} is available from CVS.  The CVS
374 version is the latest version of the code and may contain incomplete
375 features or new issues. Use these versions at your own risk.
377 Instructions for obtaining the latest development version of @tramp{}
378 from CVS can be found by going to the Savannah project page at the
379 following URL and then clicking on the CVS link in the navigation bar
380 at the top.
382 @noindent
383 @uref{http://savannah.gnu.org/projects/tramp/}
385 @noindent
386 Or follow the example session below:
388 @example
389 ] @strong{cd ~/@value{emacs-dir}}
390 ] @strong{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp login}
392 (Logging in to anoncvs@@subversions.gnu.org)
393 CVS password: @strong{(just hit RET here)}
394 @dots{}
396 ] @strong{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp co tramp}
397 @end example
399 @noindent
400 You should now have a directory @file{~/@value{emacs-dir}/tramp}
401 containing the latest version of @tramp{}. You can fetch the latest
402 updates from the repository by issuing the command:
404 @example
405 ] @strong{cd ~/@value{emacs-dir}/tramp}
406 ] @strong{cvs update -d}
407 @end example
409 @noindent
410 Once you've got updated files from the CVS repository, you need to run
411 @command{autoconf} in order to get an up-to-date @file{configure}
412 script:
414 @example
415 ] @strong{cd ~/@value{emacs-dir}/tramp}
416 ] @strong{autoconf}
417 @end example
420 @node History
421 @chapter History of @tramp{}
422 @cindex history
423 @cindex development history
425 Development was started end of November 1998.  The package was called
426 @file{rssh.el}, back then.  It only provided one method to access a
427 file, using @command{ssh} to log in to a remote host and using
428 @command{scp} to transfer the file contents.  After a while, the name
429 was changed to @file{rcp.el}, and now it's @tramp{}.  Along the way,
430 many more methods for getting a remote shell and for transferring the
431 file contents were added.  Support for VC was added.
433 The most recent addition of major features were the multi-hop methods
434 added in April 2000 and the unification of @tramp{} and Ange-FTP
435 filenames in July 2002.
437 @c Installation chapter is necessary only in case of standalone
438 @c installation.  Text taken from trampinst.texi.
439 @ifset tramp-inst
440 @installationchapter{}
441 @end ifset
443 @node Configuration
444 @chapter Configuring @tramp{} for use
445 @cindex configuration
447 @cindex default configuration
448 @tramp{} is (normally) fully functional when it is initially
449 installed.  It is initially configured to use the @command{ssh} program
450 to connect to the remote host and to use base-64 encoding (on the
451 remote host, via @command{mimencode}, and on the local host via the
452 built-in support for base-64 encoding in Emacs).
454 On some hosts, there are problems with opening a connection.  These are
455 related to the behavior of the remote shell.  See @xref{Remote shell
456 setup}, for details on this.
458 If you do not wish to use these commands to connect to the remote
459 host, you should change the default connection and transfer method
460 that @tramp uses.  There are several different methods that @tramp{}
461 can use to connect to remote machines and transfer files
462 (@pxref{Connection types}).
465 @menu
466 * Connection types::            Types of connections made to remote machines.
467 * Inline methods::              Inline methods.
468 * External transfer methods::   External transfer methods.
469 * Multi-hop Methods::           Connecting to a remote host using multiple hops.
470 * Default Method::              Selecting a default method.
471 * Customizing Methods::         Using Non-Standard Methods.
472 * Customizing Completion::      Selecting config files for user/host name completion.
473 * Remote Programs::             How @tramp{} finds and uses programs on the remote machine.
474 * Remote shell setup::          Remote shell setup hints.
475 * Windows setup hints::         Issues with Cygwin ssh.
476 * Auto-save and Backup::        Auto-save and Backup.
477 @end menu
480 @node Connection types
481 @section Types of connections made to remote machines.
482 @cindex connection types, overview
484 There are two basic types of transfer methods, each with its own
485 advantages and limitations.  Both types of connection make use of a
486 remote shell access program such as @command{rsh}, @command{ssh} or
487 @command{telnet} to connect to the remote machine.
489 This connection is used to perform many of the operations that @tramp
490 requires to make the remote file system transparently accessible from
491 the local machine. It is only when visiting files that the methods
492 differ.
494 @cindex inline methods
495 @cindex external transfer methods
496 @cindex external methods
497 @cindex out-of-band methods
498 @cindex methods, inline
499 @cindex methods, external transfer
500 @cindex methods, out-of-band
501 Loading or saving a remote file requires that the content of the file
502 be transfered between the two machines. The content of the file can be
503 transfered over the same connection used to log in to the remote
504 machine or the file can be transfered through another connection using
505 a remote copy program such as @command{rcp}, @command{scp} or
506 @command{rsync}.  The former are called @dfn{inline methods}, the
507 latter are called @dfn{out-of-band methods} or @dfn{external transfer
508 methods} (@dfn{external methods} for short).
510 The performance of the external transfer methods is generally better
511 than that of the inline methods, at least for large files.  This is
512 caused by the need to encode and decode the data when transferring
513 inline.
515 The one exception to this rule are the @command{scp} based transfer
516 methods.  While these methods do see better performance when actually
517 transferring files, the overhead of the cryptographic negotiation at
518 startup may drown out the improvement in file transfer times.
520 External transfer methods do require that the remote copy command is not
521 interactive --- that is, the command does not prompt you for a password.
522 If you cannot perform remote copies without a password, you will need to
523 use an inline transfer method to work with @tramp{}.
525 @cindex multi-hop methods
526 @cindex methods, multi-hop
527 A variant of the inline methods are the @dfn{multi-hop methods}.
528 These methods allow you to connect a remote host using a number `hops',
529 each of which connects to a different host.  This is useful if you are
530 in a secured network where you need to go through a bastion host to
531 connect to the outside world.
534 @node Inline methods
535 @section Inline methods
536 @cindex inline methods
537 @cindex methods, inline
539 The inline methods in @tramp{} are quite powerful and can work in
540 situations where you cannot use an external transfer program to connect.
541 Inline methods are the only methods that work when connecting to the
542 remote machine via telnet.  (There are also strange inline methods which
543 allow you to transfer files between @emph{user identities} rather than
544 hosts, see below.)
546 These methods depend on the existence of a suitable encoding and
547 decoding command on remote machine.  Locally, @tramp{} may be able to use
548 features of Emacs to decode and encode the files or it may require
549 access to external commands to perform that task.
551 @cindex uuencode
552 @cindex mimencode
553 @cindex base-64 encoding
554 @tramp{} checks the availability and usability of commands like
555 @command{mimencode} (part of the @command{metamail} package) or
556 @command{uuencode} on the remote host.  The first reliable command
557 will be used.  The search path can be customized, see @ref{Remote
558 Programs}.
560 If both commands aren't available on the remote host, @tramp{}
561 transfers a small piece of Perl code to the remote host, and tries to
562 apply it for encoding and decoding.
565 @table @asis
566 @item @option{rsh}
567 @cindex method rsh
568 @cindex rsh method
570 Connect to the remote host with @command{rsh}.  Due to the unsecure
571 connection it is recommended for very local host topology only.
573 On operating systems which provide the command @command{remsh} instead
574 of @command{rsh}, you can use the method @option{remsh}.  This is true
575 for HP-UX or Cray UNICOS, for example.
578 @item @option{ssh}
579 @cindex method ssh
580 @cindex ssh method
582 Connect to the remote host with @command{ssh}.  This is identical to
583 the previous option except that the @command{ssh} package is used,
584 making the connection more secure.
586 There are also two variants, @option{ssh1} and @option{ssh2}, that
587 call @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
588 explicitly select whether you want to use the SSH protocol version 1
589 or 2 to connect to the remote host.  (You can also specify in
590 @file{~/.ssh/config}, the SSH configuration file, which protocol
591 should be used, and use the regular @option{ssh} method.)
593 Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
594 @command{ssh1} and @command{ssh2} commands explicitly.  If you don't
595 know what these are, you do not need these options.
597 All the methods based on @command{ssh} have an additional kludgy
598 feature: you can specify a host name which looks like @file{host#42}
599 (the real host name, then a hash sign, then a port number).  This
600 means to connect to the given host but to also pass @code{-p 42} as
601 arguments to the @command{ssh} command.
604 @item @option{telnet}
605 @cindex method telnet
606 @cindex telnet method
608 Connect to the remote host with @command{telnet}.  This is as unsecure
609 as the @option{rsh} method.
612 @item @option{su}
613 @cindex method su
614 @cindex su method
616 This method does not connect to a remote host at all, rather it uses
617 the @command{su} program to allow you to edit files as another user.
620 @item @option{sudo}
621 @cindex method sudo
622 @cindex sudo method
624 This is similar to the @option{su} method, but it uses @command{sudo}
625 rather than @command{su} to become a different user.
627 Note that @command{sudo} must be configured to allow you to start a
628 shell as the user.  It would be nice if it was sufficient if
629 @command{ls} and @command{mimencode} were allowed, but that is not
630 easy to implement, so I haven't got around to it, yet.
633 @item @option{sshx}
634 @cindex method sshx
635 @cindex sshx method
636 @cindex Cygwin (with sshx method)
638 As you expect, this is similar to @option{ssh}, only a little
639 different.  Whereas @option{ssh} opens a normal interactive shell on
640 the remote host, this option uses @samp{ssh -t -t @var{host} -l
641 @var{user} /bin/sh} to open a connection.  This is useful for users
642 where the normal login shell is set up to ask them a number of
643 questions when logging in.  This procedure avoids these questions, and
644 just gives @tramp{} a more-or-less `standard' login shell to work
645 with.
647 Note that this procedure does not eliminate questions asked by
648 @command{ssh} itself.  For example, @command{ssh} might ask ``Are you
649 sure you want to continue connecting?'' if the host key of the remote
650 host is not known.  @tramp{} does not know how to deal with such a
651 question (yet), therefore you will need to make sure that you can log
652 in without such questions.
654 This is also useful for Windows users where @command{ssh}, when
655 invoked from an Emacs buffer, tells them that it is not allocating a
656 pseudo tty.  When this happens, the login shell is wont to not print
657 any shell prompt, which confuses @tramp{} mightily.  For reasons
658 unknown, some Windows ports for @command{ssh} (maybe the Cygwin one)
659 require the doubled @samp{-t} option.
661 This supports the @samp{-p} kludge.
664 @item @option{krlogin}
665 @cindex method krlogin
666 @cindex km krlogin
667 @cindex Kerberos (with krlogin method)
669 This method is also similar to @option{ssh}.  It only uses the
670 @command{krlogin -x} command to log in to the remote host.
673 @item @option{plink}
674 @cindex method plink
675 @cindex plink method
677 This method is mostly interesting for Windows users using the PuTTY
678 implementation of SSH.  It uses @samp{plink -ssh} to log in to the
679 remote host.
681 Additionally, the method @option{plink1} is provided, which calls
682 @samp{plink -1 -ssh} in order to use SSH protocol version 1
683 explicitely.
685 CCC: Do we have to connect to the remote host once from the command
686 line to accept the SSH key?  Maybe this can be made automatic?
688 CCC: Does @command{plink} support the @samp{-p} option?  @tramp{} will
689 support that, anyway.
691 @end table
695 @node External transfer methods
696 @section External transfer methods
697 @cindex methods, external transfer
698 @cindex methods, out-of-band
699 @cindex external transfer methods
700 @cindex out-of-band methods
702 The external transfer methods operate through multiple channels, using
703 the remote shell connection for many actions while delegating file
704 transfers to an external transfer utility.
706 This saves the overhead of encoding and decoding that multiplexing the
707 transfer through the one connection has with the inline methods.
709 If you want to use an external transfer method you @emph{must} be able
710 to execute the transfer utility to copy files to and from the remote
711 machine without any interaction.
713 @cindex ssh-agent
714 This means that you will need to use @command{ssh-agent} if you use the
715 @command{scp} program for transfers, or maybe your version of
716 @command{scp} accepts a password on the command line.@footnote{PuTTY's
717 @command{pscp} allows you to specify the password on the command line.}
718 If you use @command{rsync} via @command{ssh} then the same rule must
719 apply to that connection.
721 If you cannot get @command{scp} to run without asking for a password but
722 would still like to use @command{ssh} to secure your connection, have a
723 look at the @command{ssh} based inline methods.
726 @table @asis
727 @item @option{rcp}  ---  @command{rsh} and @command{rcp}
728 @cindex method rcp
729 @cindex rcp method
730 @cindex rcp (with rcp method)
731 @cindex rsh (with rcp method)
733 This method uses the @command{rsh} and @command{rcp} commands to connect
734 to the remote machine and transfer files.  This is probably the fastest
735 connection method available.
737 The alternative method @option{remcp} uses the @command{remsh} and
738 @command{rcp} commands.  It should be applied on machines where
739 @command{remsh} is used instead of @command{rsh}.
742 @item @option{scp}  ---  @command{ssh} and @command{scp}
743 @cindex method scp
744 @cindex scp method
745 @cindex scp (with scp method)
746 @cindex ssh (with scp method)
748 Using @command{ssh} to connect to the remote host and @command{scp} to
749 transfer files between the machines is the best method for securely
750 connecting to a remote machine and accessing files.
752 The performance of this option is also quite good. It may be slower than
753 the inline methods when you often open and close small files however.
754 The cost of the cryptographic handshake at the start of an @command{scp}
755 session can begin to absorb the advantage that the lack of encoding and
756 decoding presents.
758 There are also two variants, @option{scp1} and @option{scp2}, that
759 call @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
760 explicitly select whether you want to use the SSH protocol version 1
761 or 2 to connect to the remote host.  (You can also specify in
762 @file{~/.ssh/config}, the SSH configuration file, which protocol
763 should be used, and use the regular @option{ssh} method.)
765 Two other variants, @option{scp1_old} and @option{scp2_old}, use the
766 @command{ssh1} and @command{ssh2} commands explicitly.  If you don't
767 know what these are, you do not need these options.
769 All the @command{ssh} based methods support the kludgy @samp{-p}
770 feature where you can specify a port number to connect to in the host
771 name.  For example, the host name @file{host#42} tells @tramp{} to
772 specify @samp{-p 42} in the argument list for @command{ssh}.
775 @item @option{rsync}  ---  @command{ssh} and @command{rsync}
776 @cindex method rsync
777 @cindex rsync method
778 @cindex rsync (with rsync method)
779 @cindex ssh (with rsync method)
781 Using the @command{ssh} command to connect securely to the remote
782 machine and the @command{rsync} command to transfer files is almost
783 identical to the @option{scp} method.
785 While @command{rsync} performs much better than @command{scp} when
786 transferring files that exist on both hosts, this advantage is lost if
787 the file exists only on one side of the connection.
789 The @command{rsync} based method may be considerably faster than the
790 @command{rcp} based methods when writing to the remote system. Reading
791 files to the local machine is no faster than with a direct copy.
793 This method supports the @samp{-p} hack.
796 @item @option{scpx} --- @command{ssh} and @command{scp}
797 @cindex method scpx
798 @cindex scpx method
799 @cindex scp (with scpx method)
800 @cindex ssh (with scpx method)
801 @cindex Cygwin (with scpx method)
803 As you expect, this is similar to @option{scp}, only a little
804 different.  Whereas @option{scp} opens a normal interactive shell on
805 the remote host, this option uses @samp{ssh -t -t @var{host} -l
806 @var{user} /bin/sh} to open a connection.  This is useful for users
807 where the normal login shell is set up to ask them a number of
808 questions when logging in.  This procedure avoids these questions, and
809 just gives @tramp{} a more-or-less `standard' login shell to work
810 with.
812 This is also useful for Windows users where @command{ssh}, when
813 invoked from an Emacs buffer, tells them that it is not allocating a
814 pseudo tty.  When this happens, the login shell is wont to not print
815 any shell prompt, which confuses @tramp{} mightily.  Maybe this
816 applies to the Cygwin port of SSH.
818 This method supports the @samp{-p} hack.
821 @item @option{pscp} --- @command{plink} and @command{pscp}
822 @cindex method pscp
823 @cindex pscp method
824 @cindex pscp (with pscp method)
825 @cindex plink (with pscp method)
826 @cindex PuTTY (with pscp method)
828 This method is similar to @option{scp}, but it uses the
829 @command{plink} command to connect to the remote host, and it uses
830 @command{pscp} for transferring the files.  These programs are part
831 of PuTTY, an SSH implementation for Windows.
833 CCC: Does @command{plink} support the @samp{-p} hack?
836 @item @option{fcp} --- @command{fsh} and @command{fcp}
837 @cindex method fcp
838 @cindex fcp method
839 @cindex fsh (with fcp method)
840 @cindex fcp (with fcp method)
842 This method is similar to @option{scp}, but it uses the @command{fsh}
843 command to connect to the remote host, and it uses @command{fcp} for
844 transferring the files.  @command{fsh/fcp} are a front-end for
845 @command{ssh} which allow for reusing the same @command{ssh} session
846 for submitting several commands.  This avoids the startup overhead of
847 @command{scp} (which has to establish a secure connection whenever it
848 is called).  Note, however, that you can also use one of the inline
849 methods to achieve a similar effect.
851 This method uses the command @samp{fsh @var{host} -l @var{user}
852 /bin/sh -i} to establish the connection, it does not work to just say
853 @command{fsh @var{host} -l @var{user}}.
855 @cindex method fsh
856 @cindex fsh method
857 There is no inline method using @command{fsh} as the multiplexing
858 provided by the program is not very useful in our context.  @tramp{}
859 opens just one connection to the remote host and then keeps it open,
860 anyway.
863 @ifset emacs
864 @item @option{ftp}
865 @cindex method ftp
866 @cindex ftp method
868 This is not a native @tramp{} method. Instead of, it forwards all
869 requests to @value{ftp-package-name}.
870 @end ifset
873 @item @option{smb} --- @command{smbclient}
874 @cindex method smb
875 @cindex smb method
877 This is another not natural @tramp{} method.  It uses the
878 @command{smbclient} command on different Unices in order to connect to
879 an SMB server.  An SMB server might be a Samba (or CIFS) server on
880 another UNIX host or, more interesting, a host running MS Windows.  So
881 far, it is tested towards MS Windows NT, MS Windows 2000, and MS
882 Windows XP.
884 The first directory in the localname must be a share name on the remote
885 host.  Remember, that the @code{$} character in which default shares
886 usually end, must be written @code{$$} due to environment variable
887 substitution in file names.  If no share name is given (i.e. remote
888 directory @code{/}), all available shares are listed.
890 Since authorization is done on share level, you will be prompted
891 always for a password if you access another share on the same host.
892 Due to security reasons, the password is not cached.
894 MS Windows uses for authorization both a user name and a domain name.
895 Because of this, the @tramp{} syntax has been extended: you can
896 specify a user name which looks like @code{user%domain} (the real user
897 name, then a percent sign, then the domain name).  So, to connect to
898 the machine @code{melancholia} as user @code{daniel} of the domain
899 @code{BIZARRE}, and edit @file{.emacs} in the home directory (share
900 @code{daniel$}) I would specify the filename
901 @file{@value{tramp-prefix}smb@value{tramp-postfix-single-hop}daniel%BIZARRE@@melancholia@value{tramp-postfix}/daniel$$/.emacs}.
903 The domain name as well as the user name are optional.  If no user
904 name is specified at all, the anonymous user (without password
905 prompting) is assumed.  This is different from all other @tramp{}
906 methods, where in such a case the local user name is taken.
908 The @option{smb} method supports the @samp{-p} hack.
910 @strong{Please note:} If Emacs runs locally under MS Windows, this
911 method isn't available.  Instead of, you can use UNC file names like
912 @file{//melancholia/daniel$$/.emacs}.  The only disadvantage is that
913 there's no possibility to specify another user name.
915 @end table
917 @node Multi-hop Methods
918 @section Connecting to a remote host using multiple hops
919 @cindex multi-hop methods
920 @cindex methods, multi-hop
922 Sometimes, the methods described before are not sufficient.  Sometimes,
923 it is not possible to connect to a remote host using a simple command.
924 For example, if you are in a secured network, you might have to log in
925 to a `bastion host' first before you can connect to the outside world.
926 Of course, the target host may also require a bastion host.  The format
927 of multi-hop filenames is slightly different than the format of normal
928 @tramp{} methods.
930 @cindex method multi
931 @cindex multi method
932 A multi-hop file name specifies a method, a number of hops, and a
933 localname (path name on the remote system).  The method name is always
934 @option{multi}.
936 Each hop consists of a @dfn{hop method} specification, a user name and
937 a host name.  The hop method can be an inline method only.  The
938 following hop methods are (currently) available:
940 @table @option
941 @item telnet
942 @cindex hop method telnet
943 @cindex telnet hop method
945 Uses the well-known @command{telnet} program to connect to the host.
946 Whereas user name and host name are supplied in the file name, the
947 user is queried for the password.
949 @item rsh
950 @cindex hop method rsh
951 @cindex rsh hop method
953 This uses @command{rsh} to connect to the host.  You do not need to
954 enter a password unless @command{rsh} explicitly asks for it.
956 The variant @option{remsh} uses the @command{remsh} command.  It
957 should be applied on machines where @command{remsh} is used instead of
958 @command{rsh}.
960 @item ssh
961 @cindex hop method ssh
962 @cindex ssh hop method
964 This uses @command{ssh} to connect to the host.  You might have to enter
965 a password or a pass phrase.
967 @item su
968 @cindex hop method su
969 @cindex su hop method
971 This method does not actually contact a different host, but it allows
972 you to become a different user on the host you're currently on.  This
973 might be useful if you want to edit files as root, but the remote host
974 does not allow remote root logins.  In this case you can use
975 @option{telnet}, @option{rsh} or @option{ssh} to connect to the
976 remote host as a non-root user, then use an @option{su} hop to become
977 root.  But @option{su} need not be the last hop in a sequence, you could
978 also use it somewhere in the middle, if the need arises.
980 Even though you @emph{must} specify both user and host with an
981 @option{su} hop, the host name is ignored and only the user name is
982 used.
984 @item sudo
985 @cindex hop method sudo
986 @cindex sudo hop method
988 This is similar to the @option{su} hop, except that it uses
989 @command{sudo} rather than @command{su} to become a different user.
991 @end table
993 Some people might wish to use port forwarding with @command{ssh} or
994 maybe they have to use a nonstandard port.  This can be accomplished
995 by putting a stanza in @file{~/.ssh/config} for the account which
996 specifies a different port number for a certain host name.  But it can
997 also be accomplished within @tramp{}, by adding a multi-hop method.
998 For example:
1000 @lisp
1001 (add-to-list
1002  'tramp-multi-connection-function-alist
1003  '("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n"))
1004 @end lisp
1006 Now you can use an @code{sshf} hop which connects to port 4400 instead of
1007 the standard port.
1010 @node Default Method
1011 @section Selecting a default method
1012 @cindex default method
1014 @vindex tramp-default-method
1015 When you select an appropriate transfer method for your typical usage
1016 you should set the variable @var{tramp-default-method} to reflect that
1017 choice.  This variable controls which method will be used when a method
1018 is not specified in the @tramp{} file name.  For example:
1020 @lisp
1021 (setq tramp-default-method "scp")
1022 @end lisp
1024 @vindex tramp-default-method-alist
1025 You can also specify different methods for certain user/host
1026 combinations, via the variable @var{tramp-default-method-alist}.  For
1027 example, the following two lines specify to use the @option{ssh}
1028 method for all user names matching @samp{john} and the @option{rsync}
1029 method for all host names matching @samp{lily}.  The third line
1030 specifies to use the @option{su} method for the user @samp{root} on
1031 the machine @samp{localhost}.
1033 @lisp
1034 (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
1035 (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1036 (add-to-list 'tramp-default-method-alist
1037              '("\\`localhost\\'" "\\`root\\'" "su"))
1038 @end lisp
1040 @noindent
1041 See the documentation for the variable
1042 @var{tramp-default-method-alist} for more details.
1044 External transfer methods are normally preferable to inline transfer
1045 methods, giving better performance. They may not be useful if you use
1046 many remote machines where you cannot log in without a password.
1048 @xref{Inline methods}.
1049 @xref{External transfer methods}.
1050 @xref{Multi-hop Methods}.
1052 Another consideration with the selection of transfer methods is the
1053 environment you will use them in and, especially when used over the
1054 Internet, the security implications of your preferred method.
1056 The @command{rsh} and @command{telnet} methods send your password as
1057 plain text as you log in to the remote machine, as well as transferring
1058 the files in such a way that the content can easily be read from other
1059 machines.
1061 If you need to connect to remote systems that are accessible from the
1062 Internet, you should give serious thought to using @command{ssh} based
1063 methods to connect. These provide a much higher level of security,
1064 making it a non-trivial exercise for someone to obtain your password or
1065 read the content of the files you are editing.
1067 @node Customizing Methods
1068 @section Using Non-Standard Methods
1069 @cindex customizing methods
1070 @cindex using non-standard methods
1071 @cindex create your own methods
1073 There is a variable @code{tramp-methods} which you can change if the
1074 predefined methods don't seem right.
1076 For the time being, I'll refer you to the Lisp documentation of that
1077 variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1080 @node Customizing Completion
1081 @section Selecting config files for user/host name completion
1082 @cindex customizing completion
1083 @cindex selecting config files
1084 @vindex tramp-completion-function-alist
1086 The variable @code{tramp-completion-function-alist} is intended to
1087 customize which files are taken into account for user and host name
1088 completion (@pxref{Filename completion}).  For every method, it keeps
1089 a set of configuration files, accompanied by a Lisp function able to
1090 parse that file.  Entries in @code{tramp-completion-function-alist}
1091 have the form (@var{method} @var{pair1} @var{pair2} ...).
1093 Each @var{pair} is composed of (@var{function} @var{file}).
1094 @var{function} is responsible to extract user names and host names
1095 from @var{file} for completion.  There are two functions which access
1096 this variable:
1098 @defun tramp-get-completion-function method
1099 This function returns the list of completion functions for @var{method}.
1101 Example:
1102 @example
1103 (tramp-get-completion-function "rsh")
1105      @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1106          (tramp-parse-rhosts "~/.rhosts"))
1107 @end example
1108 @end defun
1110 @defun tramp-set-completion-function method function-list
1111 This function sets @var{function-list} as list of completion functions
1112 for @var{method}. 
1114 Example:
1115 @example
1116 (tramp-set-completion-function "ssh"
1117  '((tramp-parse-sconfig "/etc/ssh_config")
1118    (tramp-parse-sconfig "~/.ssh/config")))
1120      @result{} ((tramp-parse-sconfig "/etc/ssh_config")
1121          (tramp-parse-sconfig "~/.ssh/config"))
1122 @end example
1123 @end defun
1125 The following predefined functions parsing configuration files exist:
1127 @table @asis
1128 @item @code{tramp-parse-rhosts}
1129 @findex tramp-parse-rhosts
1131 This function parses files which are syntactical equivalent to
1132 @file{~/.rhosts}.  It returns both host names and user names, if
1133 specified.
1135 @item @code{tramp-parse-shosts}
1136 @findex tramp-parse-shosts
1138 This function parses files which are syntactical equivalent to
1139 @file{~/.ssh/known_hosts}.  Since there are no user names specified
1140 in such files, it can return host names only.
1142 @item @code{tramp-parse-sconfig}
1143 @findex tramp-parse-shosts
1145 This function returns the host nicknames defined by @code{Host} entries
1146 in @file{~/.ssh/config} style files.
1148 @item @code{tramp-parse-hosts}
1149 @findex tramp-parse-hosts
1151 A function dedicated to @file{/etc/hosts} style files.  It returns
1152 host names only.
1154 @item @code{tramp-parse-passwd}
1155 @findex tramp-parse-passwd
1157 A function which parses @file{/etc/passwd} like files.  Obviously, it
1158 can return user names only.
1160 @item @code{tramp-parse-netrc}
1161 @findex tramp-parse-netrc
1163 Finally, a function which parses @file{~/.netrc} like files.
1164 @end table
1166 If you want to keep your own data in a file, with your own structure,
1167 you might provide such a function as well.  This function must meet
1168 the following conventions:
1170 @defun my-tramp-parse file
1171 @var{file} must be either a file name on your host, or @code{nil}. The
1172 function must return a list of (@var{user} @var{host}), which are
1173 taken as candidates for user and host name completion.
1175 Example:
1176 @example
1177 (my-tramp-parse "~/.my-tramp-hosts")
1179      @result{} ((nil "toto") ("daniel" "melancholia"))
1180 @end example
1181 @end defun
1184 @node Remote Programs
1185 @section How @tramp{} finds and uses programs on the remote machine.
1187 @tramp{} depends on a number of programs on the remote host in order to
1188 function, including @command{ls}, @command{test}, @command{find} and
1189 @command{cat}.
1191 In addition to these required tools, there are various tools that may be
1192 required based on the connection method. See @ref{Inline methods} and
1193 @ref{External transfer methods} for details on these.
1195 Certain other tools, such as @command{perl} (or @command{perl5}) and
1196 @command{grep} will be used if they can be found. When they are
1197 available, they are used to improve the performance and accuracy of
1198 remote file access.
1200 @vindex tramp-remote-path
1201 When @tramp{} connects to the remote machine, it searches for the
1202 programs that it can use. The variable @var{tramp-remote-path} controls
1203 the directories searched on the remote machine.
1205 By default, this is set to a reasonable set of defaults for most
1206 machines. It is possible, however, that your local (or remote ;) system
1207 administrator has put the tools you want in some obscure local
1208 directory.
1210 In this case, you can still use them with @tramp{}. You simply need to
1211 add code to your @file{.emacs} to add the directory to the remote path.
1212 This will then be searched by @tramp{} when you connect and the software
1213 found.
1215 To add a directory to the remote search path, you could use code such
1218 @lisp
1219 @i{;; We load @tramp{} to define the variable.}
1220 (require 'tramp)
1221 @i{;; We have @command{perl} in "/usr/local/perl/bin"}
1222 (add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1223 @end lisp
1226 @node Remote shell setup
1227 @comment  node-name,  next,  previous,  up
1228 @section Remote shell setup hints
1229 @cindex remote shell setup
1230 @cindex @file{.profile} file
1231 @cindex @file{.login} file
1232 @cindex shell init files
1234 As explained in the @ref{Overview} section, @tramp{} connects to the
1235 remote host and talks to the shell it finds there.  Of course, when you
1236 log in, the shell executes its init files.  Suppose your init file
1237 requires you to enter the birth date of your mother; clearly @tramp{}
1238 does not know this and hence fails to log you in to that host.
1240 There are different possible strategies for pursuing this problem.  One
1241 strategy is to enable @tramp{} to deal with all possible situations.
1242 This is a losing battle, since it is not possible to deal with
1243 @emph{all} situations.  The other strategy is to require you to set up
1244 the remote host such that it behaves like @tramp{} expect.  This might
1245 be inconvenient because you have to invest a lot of effort into shell
1246 setup before you can begin to use @tramp{}.
1248 The package, therefore, pursues a combined approach.  It tries to figure
1249 out some of the more common setups, and only requires you to avoid
1250 really exotic stuff.  For example, it looks through a list of
1251 directories to find some programs on the remote host.  And also, it
1252 knows that it is not obvious how to check whether a file exists, and
1253 therefore it tries different possibilities.  (On some hosts and shells,
1254 the command @code{test -e} does the trick, on some hosts the shell
1255 builtin doesn't work but the program @code{/usr/bin/test -e} or
1256 @code{/bin/test -e} works.  And on still other hosts, @code{ls -d} is
1257 the right way to do this.)
1259 Below you find a discussion of a few things that @tramp{} does not deal
1260 with, and that you therefore have to set up correctly.
1262 @table @asis
1263 @item @var{shell-prompt-pattern}
1264 @vindex shell-prompt-pattern
1266 After logging in to the remote host, @tramp{} has to wait for the remote
1267 shell startup to finish before it can send commands to the remote
1268 shell.  The strategy here is to wait for the shell prompt.  In order to
1269 recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1270 to be set correctly to recognize the shell prompt on the remote host.
1272 Note that @tramp{} requires the match for @code{shell-prompt-pattern}
1273 to be at the end of the buffer.  Many people have something like the
1274 following as the value for the variable: @code{"^[^>$][>$] *"}.  Now
1275 suppose your shell prompt is @code{a <b> c $ }.  In this case,
1276 @tramp{} recognizes the @code{>} character as the end of the prompt,
1277 but it is not at the end of the buffer.
1279 @item @var{tramp-shell-prompt-pattern}
1280 @vindex tramp-shell-prompt-pattern
1282 This regular expression is used by @tramp{} in the same way as
1283 @code{shell-prompt-pattern}, to match prompts from the remote shell.
1284 This second variable exists because the prompt from the remote shell
1285 might be different from the prompt from a local shell --- after all,
1286 the whole point of @tramp{} is to log in to remote hosts as a
1287 different user.  The default value of
1288 @code{tramp-shell-prompt-pattern} is the same as the default value of
1289 @code{shell-prompt-pattern}, which is reported to work well in many
1290 circumstances.
1292 @item @code{tset} and other questions
1293 @cindex Unix command tset
1294 @cindex tset Unix command
1296 Some people invoke the @code{tset} program from their shell startup
1297 scripts which asks the user about the terminal type of the shell.
1298 Maybe some shells ask other questions when they are started.  @tramp{}
1299 does not know how to answer these questions.  There are two approaches
1300 for dealing with this problem.  One approach is to take care that the
1301 shell does not ask any questions when invoked from @tramp{}.  You can
1302 do this by checking the @code{TERM} environment variable, it will be
1303 set to @code{dumb} when connecting.
1305 @vindex tramp-terminal-type
1306 The variable @code{tramp-terminal-type} can be used to change this value
1307 to @code{dumb}.
1309 The other approach is to teach @tramp{} about these questions.  See
1310 the variables @code{tramp-actions-before-shell} and
1311 @code{tramp-multi-actions} (for multi-hop connections).
1313 @end table
1316 @node Auto-save and Backup
1317 @section Auto-save and Backup configuration
1318 @cindex auto-save
1319 @cindex backup
1320 @vindex backup-directory-alist
1322 Explaining auto-save is still to do.
1324 Normally, Emacs writes backup files to the same directory as the
1325 original files, but this behavior can be changed via the variable
1326 @code{backup-directory-alist}.  In connection with @tramp{}, this can
1327 have unexpected side effects.  Suppose that you specify that all backups
1328 should go to the directory @file{~/.emacs.d/backups/}, and then you edit
1329 the file @file{/su:root@@localhost:/etc/secretfile}.  The effect is that
1330 the backup file will be owned by you and not by root, thus possibly
1331 enabling others to see it even if they were not intended to see it.
1333 When @code{backup-directory-alist} is nil (the default), such problems
1334 do not occur.
1336 If you wish to customize the variable, the workaround is to include
1337 special settings for Tramp files.  For example, the following statement
1338 effectively `turns off' the effect of @code{backup-directory-alist} for
1339 @tramp{} files:
1341 @lisp
1342 (require 'tramp)
1343 (add-to-list 'backup-directory-alist
1344              (cons tramp-file-name-regexp nil))
1345 @end lisp
1348 @node Windows setup hints
1349 @section Issues with Cygwin ssh
1350 @cindex Cygwin, issues
1352 This section needs a lot of work!  Please help.
1354 @cindex method sshx with Cygwin
1355 @cindex sshx method with Cygwin
1356 If you use the Cygwin installation of ssh (you have to explicitly select
1357 it in the installer), then it should work out of the box to just select
1358 @code{sshx} as the connection method.  You can find information about
1359 setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}.
1361 @cindex method scpx with Cygwin
1362 @cindex scpx method with Cygwin
1363 If you wish to use the @code{scpx} connection method, then you might
1364 have the problem that Emacs calls @code{scp} with a Windows filename
1365 such as @code{c:/foo}.  The Cygwin version of @code{scp} does not know
1366 about Windows filenames and interprets this as a remote filename on the
1367 host @code{c}.
1369 One possible workaround is to write a wrapper script for @code{scp}
1370 which converts the Windows filename to a Cygwinized filename.
1372 I guess that another workaround is to run Emacs under Cygwin, or to run
1373 a Cygwinized Emacs.
1375 @cindex Cygwin and ssh-agent
1376 @cindex SSH_AUTH_SOCK and Emacs on Windows
1377 If you want to use either @code{ssh} based method on Windows, then you
1378 might encounter problems with @code{ssh-agent}.  Using this program,
1379 you can avoid typing the pass-phrase every time you log in (and the
1380 @code{scpx} method more or less requires you to use @code{ssh-agent}
1381 because it does not allow you to type a password or pass-phrase).
1382 However, if you start Emacs from a desktop shortcut, then the
1383 environment variable @code{SSH_AUTH_SOCK} is not set and so Emacs and
1384 thus @tramp{} and thus @code{ssh} and @code{scp} started from @tramp{}
1385 cannot communicate with @code{ssh-agent}.  It works better to start
1386 Emacs from the shell.
1388 If anyone knows how to start @code{ssh-agent} under Windows in such a
1389 way that desktop shortcuts can profit, please holler.  I don't really
1390 know anything at all about Windows@dots{}
1393 @node Usage
1394 @chapter Using @tramp
1395 @cindex using @tramp
1397 Once you have installed @tramp{} it will operate fairly transparently. You
1398 will be able to access files on any remote machine that you can log in
1399 to as though they were local.
1401 Files are specified to @tramp{} using a formalized syntax specifying the
1402 details of the system to connect to.  This is similar to the syntax used
1403 by the @value{ftp-package-name} package.
1405 @cindex type-ahead
1406 Something that might happen which surprises you is that Emacs
1407 remembers all your keystrokes, so if you see a password prompt from
1408 Emacs, say, and hit @kbd{@key{RET}} twice instead of once, then the
1409 second keystroke will be processed by Emacs after @tramp{} has done
1410 its thing.  Why, this type-ahead is normal behavior, you say.  Right
1411 you are, but be aware that opening a remote file might take quite a
1412 while, maybe half a minute when a connection needs to be opened.
1413 Maybe after half a minute you have already forgotten that you hit that
1414 key!
1416 @menu
1417 * Filename Syntax::             @tramp{} filename conventions.
1418 * Multi-hop filename syntax::   Multi-hop filename conventions.
1419 * Filename completion::         Filename completion.
1420 * Dired::                       Dired.
1421 @end menu
1424 @node Filename Syntax
1425 @section @tramp{} filename conventions
1426 @cindex filename syntax
1427 @cindex filename examples
1429 To access the file @var{localname} on the remote machine @var{machine} you
1430 would specify the filename
1431 @file{@value{tramp-prefix}@var{machine}@value{tramp-postfix}@var{localname}}.
1432 This will connect to @var{machine} and transfer the file using the
1433 default method.  @xref{Default Method}.
1435 Some examples of @tramp{} filenames are shown below.
1437 @table @file
1438 @item @value{tramp-prefix}melancholia@value{tramp-postfix}.emacs
1439 Edit the file @file{.emacs} in your home directory on the machine
1440 @code{melancholia}.
1442 @item @value{tramp-prefix}melancholia.danann.net@value{tramp-postfix}.emacs
1443 This edits the same file, using the fully qualified domain name of
1444 the machine.
1446 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~/.emacs
1447 This also edits the same file --- the @file{~} is expanded to your
1448 home directory on the remote machine, just like it is locally.
1450 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~daniel/.emacs
1451 This edits the file @file{.emacs} in the home directory of the user
1452 @code{daniel} on the machine @code{melancholia}. The @file{~<user>}
1453 construct is expanded to the home directory of that user on the remote
1454 machine.
1456 @item @value{tramp-prefix}melancholia@value{tramp-postfix}/etc/squid.conf
1457 This edits the file @file{/etc/squid.conf} on the machine
1458 @code{melancholia}.
1460 @end table
1462 Unless you specify a different name to use, @tramp{} will use the
1463 current local user name as the remote user name to log in with. If you
1464 need to log in as a different user, you can specify the user name as
1465 part of the filename.
1467 To log in to the remote machine as a specific user, you use the syntax
1468 @file{@value{tramp-prefix}@var{user}@@@var{machine}@value{tramp-postfix}/@var{path/to.file}}.
1469 That means that connecting to @code{melancholia} as @code{daniel} and
1470 editing @file{.emacs} in your home directory you would specify
1471 @file{@value{tramp-prefix}daniel@@melancholia@value{tramp-postfix}.emacs}.
1473 It is also possible to specify other file transfer methods
1474 (@pxref{Default Method}) as part of the filename.
1475 @ifset emacs
1476 This is done by putting the method before the user and host name, as
1478 @file{@value{tramp-prefix}@var{method}@value{tramp-postfix-single-hop}}
1479 (Note the trailing colon).
1480 @end ifset
1481 @ifset xemacs
1482 This is done by replacing the initial
1483 @file{@value{tramp-prefix}} with
1484 @file{@value{tramp-prefix}<method>@value{tramp-postfix-single-hop}}.
1485 (Note the trailing slash!).
1486 @end ifset
1487 The user, machine and file specification remain the same.
1489 So, to connect to the machine @code{melancholia} as @code{daniel},
1490 using the @option{su} method to transfer files, and edit @file{.emacs}
1491 in my home directory I would specify the filename
1492 @file{@value{tramp-prefix}su@value{tramp-postfix-single-hop}daniel@@melancholia@value{tramp-postfix}.emacs}.
1495 @node Multi-hop filename syntax
1496 @section Multi-hop filename conventions
1497 @cindex filename syntax for multi-hop files
1498 @cindex multi-hop filename syntax
1500 The syntax of multi-hop file names is necessarily slightly different
1501 than the syntax of other @tramp{} file names.  Here's an example
1502 multi-hop file name, first in Emacs syntax and then in XEmacs syntax:
1504 @example
1505 @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
1506 @end example
1508 This is quite a mouthful.  So let's go through it step by step.  The
1509 file name consists of three parts.
1510 @ifset emacs
1511 The parts are separated by colons
1512 @end ifset
1513 @ifset xemacs
1514 The parts are separated by slashes and square brackets.
1515 @end ifset
1516 The first part is @file{@value{tramp-prefix}multi}, the method
1517 specification.  The second part is
1518 @file{rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host}
1519 and specifies the hops.  The final part is @file{/path/to.file} and
1520 specifies the file name on the remote host.
1522 The first part and the final part should be clear.  See @ref{Multi-hop
1523 Methods}, for a list of alternatives for the method specification.
1525 The second part can be subdivided again into components, so-called
1526 hops.  In the above file name, there are two hops,
1527 @file{rsh@value{tramp-postfix-multi-hop}out@@gate} and
1528 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}.
1530 Each hop can @emph{again} be subdivided into (three) components, the
1531 @dfn{hop method}, the @dfn{user name} and the @dfn{host name}.  The
1532 meaning of the second and third component should be clear, and the hop
1533 method says what program to use to perform that hop.
1535 The first hop, @file{rsh@value{tramp-postfix-multi-hop}out@@gate},
1536 says to use @command{rsh} to log in as user @code{out} to the host
1537 @code{gate}.  Starting at that host, the second hop,
1538 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}, says to
1539 use @command{telnet} to log in as user @code{kai} to host
1540 @code{real.host}.
1542 @xref{Multi-hop Methods}, for a list of possible hop method values.
1543 The variable @code{tramp-multi-connection-function-alist} contains the
1544 list of possible hop methods and information on how to execute them,
1545 should you want to add your own.
1548 @node Filename completion
1549 @section Filename completion
1550 @cindex filename completion
1552 Filename completion works with @tramp{} for both completing methods,
1553 user names and machine names (except multi hop methods) as well as for
1554 files on remote machines.
1556 If you, for example, type @kbd{C-x C-f @value{tramp-prefix}t
1557 @key{TAB}}, @tramp{} might give you as result the choice for
1559 @example
1560 @ifset emacs
1561 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}                              tmp/
1562 @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1563 @end ifset
1564 @ifset xemacs
1565 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}                              @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1566 @end ifset
1567 @end example
1569 @samp{@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}}
1570 is a possible completion for the respective method,
1571 @ifset emacs
1572 @samp{tmp/} stands for the directory @file{/tmp} on your local
1573 machine,
1574 @end ifset
1575 and @samp{@value{tramp-prefix-single-hop}toto@value{tramp-postfix}}
1576 might be a host @tramp has detected in your @file{~/.ssh/known_hosts}
1577 file (given you're using default method @option{ssh}).
1579 If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
1580 @samp{@value{tramp-prefix}telnet@value{tramp-postfix-single-hop}}.
1581 Next @kbd{@key{TAB}} brings you all machine names @tramp{} detects in
1582 your @file{/etc/hosts} file, let's say
1584 @example
1585 @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}
1586 @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}
1587 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia@value{tramp-postfix}
1588 @end example
1590 Now you can choose the desired machine, and you can continue to
1591 complete file names on that machine.
1593 As filename completion needs to fetch the listing of files from the
1594 remote machine, this feature is sometimes fairly slow.  As @tramp{}
1595 does not yet cache the results of directory listing, there is no gain
1596 in performance the second time you complete filenames.
1598 If the configuration files (@pxref{Customizing Completion}), which
1599 @tramp{} uses for analysis of completion, offer user names, those user
1600 names will be taken into account as well.
1603 @node Dired
1604 @section Dired
1605 @cindex dired
1607 @tramp{} works transparently with dired, enabling you to use this powerful
1608 file management tool to manage files on any machine you have access to
1609 over the Internet.
1611 If you need to browse a directory tree, Dired is a better choice, at
1612 present, than filename completion.  Dired has its own cache mechanism
1613 and will only fetch the directory listing once.
1616 @node Bug Reports
1617 @chapter Reporting Bugs and Problems
1618 @cindex bug reports
1620 Bugs and problems with @tramp{} are actively worked on by the development
1621 team. Feature requests and suggestions are also more than welcome.
1623 The @tramp{} mailing list is a great place to get information on working
1624 with @tramp{}, solving problems and general discussion and advice on topics
1625 relating to the package.
1627 The  mailing list is at @email{tramp-devel@@mail.freesoftware.fsf.org}.
1628 Messages sent to this address go to all the subscribers. This is
1629 @emph{not} the address to send subscription requests to.
1631 For help on subscribing to the list, send mail to the administrative
1632 address, @email{tramp-devel-request@@mail.freesoftware.fsf.org}, with the
1633 subject @samp{help}.
1635 To report a bug in @tramp{}, you should execute @kbd{M-x tramp-bug}. This
1636 will automatically generate a buffer with the details of your system and
1637 @tramp{} version.
1639 When submitting a bug report, please try to describe in excruciating
1640 detail the steps required to reproduce the problem, the setup of the
1641 remote machine and any special conditions that exist.
1643 If you can identify a minimal test case that reproduces the problem,
1644 include that with your bug report. This will make it much easier for the
1645 development team to analyze and correct the problem.
1647 @node Frequently Asked Questions
1648 @chapter Frequently Asked Questions
1649 @cindex frequently asked questions
1650 @cindex FAQ
1652 @itemize @bullet
1653 @item
1654 Where can I get the latest @tramp{}?
1656 @tramp{} is available under the URL below.
1658 @noindent
1659 @uref{http://savannah.nongnu.org/download/tramp/}
1661 @noindent
1662 There is also a Savannah project page.
1664 @noindent
1665 @uref{https://savannah.gnu.org/projects/tramp/}
1667 @item
1668 Which systems does it work on?
1670 The package has been used successfully on Emacs 20 and Emacs 21, as well
1671 as XEmacs 21.  XEmacs 20 is more problematic, see the notes in
1672 @file{tramp.el}.  I don't think anybody has really tried it on Emacs 19.
1674 The package was intended to work on Unix, and it really expects a
1675 Unix-like system on the remote end, but some people seemed to have some
1676 success getting it to work on NT Emacs.
1678 There is some informations on @tramp{} on NT at the following URL;
1679 many thanks to Joe Stoy for providing the information:
1680 @uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}
1682 The above mostly contains patches to old ssh versions; Tom Roche has a
1683 Web page with instructions:
1684 @uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
1686 ??? Is the XEmacs info correct?
1688 ??? Can somebody provide some information for getting it to work on NT
1689 Emacs?  I think there was some issue with @command{ssh}?
1692 @item
1693 I can't stop @value{ftp-package-name} starting with @value{emacs-name}
1695 @ifset emacs
1696 @value{ftp-package-name} is loaded from @tramp{} automatically if you
1697 require a file by the ftp method.  Unfortunately, there are some Lisp
1698 packages which make @value{ftp-package-name} file name handlers active.
1699 You can see it applying @kbd{C-h v file-name-handler-alist}:
1701 @example
1702 file-name-handler-alist's value is 
1703 (("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
1704  ("^/[^/:]*[^/:.]:" . ange-ftp-hook-function)
1705  ("^/[^/]*$" . tramp-completion-file-name-handler)
1706  ("\\`/[^/:]+:" . tramp-file-name-handler)
1707  ("\\`/:" . file-name-non-special))
1708 @end example
1710 Please try to find out which package is responsible for loading
1711 @value{ftp-package-name}, and raise a bug report.
1713 A workaround is to require @value{ftp-package-name} before @tramp{} in
1714 your @file{~/.emacs}, because @tramp{} cleans up the entries in
1715 @code{file-name-handler-alist}:
1717 @lisp
1718 ;; @value{ftp-package-name} temporarily required
1719 (require 'ange-ftp)
1720 ;; @tramp{} cleans up @code{file-name-handler-alist}
1721 (require 'tramp)
1722 @end lisp
1723 @end ifset
1725 @ifset xemacs
1726 Not all the older versions of @tramp{} supported @value{emacs-name}
1727 correctly.  The first thing to do is to make sure that you have the
1728 latest version of @tramp{} installed.
1730 If you do, please try and find out exactly the conditions required for
1731 the @value{ftp-package-name} handlers to fire.  If you can, putting a
1732 breakpoint on @code{efs-ftp-path} and sending in the stack trace along
1733 with your bug report would make it easier for the developers to work out
1734 what is going wrong.
1735 @end ifset
1738 @item
1739 File name completion does not work with @tramp{}
1741 When you log in to the remote machine, do you see the output of
1742 @command{ls} in color? If so, this may be the cause of your problems.
1744 @command{ls} outputs @acronym{ANSI} escape sequences that your terminal
1745 emulator interprets to set the colors.  These escape sequences will
1746 confuse @tramp{} however.
1748 In your @file{.bashrc}, @file{.profile} or equivalent on the remote
1749 machine you probably have an alias configured that adds the option
1750 @option{--color=yes} or @option{--color=auto}.
1752 You should remove that alias and ensure that a new login @emph{does not}
1753 display the output of @command{ls} in color.  If you still cannot use
1754 filename completion, report a bug to the @tramp{} developers.
1757 @item
1758 File name completion does not work in large directories
1760 @tramp{} uses globbing for some operations.  (Globbing means to use the
1761 shell to expand wildcards such as `*.c'.)  This might create long
1762 command lines, especially in directories with many files.  Some shells
1763 choke on long command lines, or don't cope well with the globbing
1764 itself.
1766 If you have a large directory on the remote end, you may wish to execute
1767 a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
1768 Note that you must first start the right shell, which might be
1769 @command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
1770 of those supports tilde expansion.
1773 @item
1774 What kinds of systems does @tramp{} work on
1776 @tramp{} really expects the remote system to be a Unix-like system.  The
1777 local system should preferably be Unix-like, as well, but @tramp{} might
1778 work on NT with some tweaking.
1781 @item
1782 How can I get notified when @tramp{} file transfers are complete?
1784 The following snippet can be put in your @file{~/.emacs} file.  It makes
1785 Emacs beep after reading from or writing to the remote host.
1787 @lisp
1788 (defadvice tramp-handle-write-region
1789   (after tramp-write-beep-advice activate)
1790  " make tramp beep after writing a file."
1791  (interactive)
1792  (beep))
1793 (defadvice tramp-handle-do-copy-or-rename-file
1794   (after tramp-copy-beep-advice activate)
1795  " make tramp beep after copying a file."
1796  (interactive)
1797  (beep))
1798 (defadvice tramp-handle-insert-file-contents
1799   (after tramp-copy-beep-advice activate)
1800  " make tramp beep after copying a file."
1801  (interactive)
1802  (beep))
1803 @end lisp
1806 @item
1807 There's this @file{~/.sh_history} file on the remote host which keeps
1808 growing and growing.  What's that?
1810 Sometimes, @tramp{} starts @code{ksh} on the remote host for tilde
1811 expansion.  Maybe @code{ksh} saves the history by default.  @tramp{}
1812 tries to turn off saving the history, but maybe you have to help.  For
1813 example, you could put this in your @file{.kshrc}:
1815 @example
1816 if [ -f $HOME/.sh_history ] ; then
1817    /bin/rm $HOME/.sh_history
1819 if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
1820    unset HISTFILE
1822 if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
1823    unset HISTSIZE
1825 @end example
1828 @item @tramp{} doesn't transfer strings with more than 500 characters
1829 correctly
1831 On some few systems, the implementation of @code{process-send-string}
1832 seems to be broken for longer strings.  This case, you should
1833 customize the variable @code{tramp-chunksize} to 500.  For a
1834 description how to determine whether this is necessary see the
1835 documentation of @code{tramp-chunksize}.
1837 @end itemize
1840 @c For the developer
1841 @node Version Control
1842 @chapter The inner workings of remote version control
1843 @cindex Version Control
1845 Unlike @value{ftp-package-name}, @tramp{} has full shell access to the
1846 remote machine. This makes it possible to provide version control for
1847 files accessed under @tramp{}.
1849 The actual version control binaries must be installed on the remote
1850 machine, accessible in the directories specified in
1851 @var{tramp-remote-path}.
1853 This transparent integration with the version control systems is one of
1854 the most valuable features provided by @tramp{}, but it is far from perfect.
1855 Work is ongoing to improve the transparency of the system.
1857 @menu
1858 * Version Controlled Files::    Determining if a file is under version control.
1859 * Remote Commands::             Executing the version control commands on the remote machine.
1860 * Changed workfiles::           Detecting if the working file has changed.
1861 * Checking out files::          Bringing the workfile out of the repository.
1862 * Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
1863 @end menu
1866 @node Version Controlled Files
1867 @section Determining if a file is under version control
1869 The VC package uses the existence of on-disk revision control master
1870 files to determine if a given file is under revision control. These file
1871 tests happen on the remote machine through the standard @tramp{} mechanisms.
1874 @node Remote Commands
1875 @section Executing the version control commands on the remote machine
1877 There are no hooks provided by VC to allow intercepting of the version
1878 control command execution. The calls occur through the
1879 @code{call-process} mechanism, a function that is somewhat more
1880 efficient than the @code{shell-command} function but that does not
1881 provide hooks for remote execution of commands.
1883 To work around this, the functions @code{vc-do-command} and
1884 @code{vc-simple-command} have been advised to intercept requests for
1885 operations on files accessed via @tramp{}.
1887 In the case of a remote file, the @code{shell-command} interface is
1888 used, with some wrapper code, to provide the same functionality on the
1889 remote machine as would be seen on the local machine. 
1892 @node Changed workfiles
1893 @section Detecting if the working file has changed
1895 As there is currently no way to get access to the mtime of a file on a
1896 remote machine in a portable way, the @code{vc-workfile-unchanged-p}
1897 function is advised to call an @tramp{} specific function for remote files.
1899 The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
1900 diff functionality to determine if any changes have occurred between the
1901 workfile and the version control master.
1903 This requires that a shell command be executed remotely, a process that
1904 is notably heavier-weight than the mtime comparison used for local
1905 files. Unfortunately, unless a portable solution to the issue is found,
1906 this will remain the cost of remote version control.
1909 @node Checking out files
1910 @section Bringing the workfile out of the repository
1912 VC will, by default, check for remote files and refuse to act on them
1913 when checking out files from the repository. To work around this
1914 problem, the function @code{vc-checkout} knows about @tramp{} files and
1915 allows version control to occur.
1918 @node Miscellaneous Version Control
1919 @section Things related to Version Control that don't fit elsewhere
1921 Minor implementation details, &c.
1923 @menu
1924 * Remote File Ownership::       How VC determines who owns a workfile.
1925 * Back-end Versions::           How VC determines what release your RCS is.
1926 @end menu
1929 @node Remote File Ownership
1930 @subsection How VC determines who owns a workfile
1932 Emacs provides the @code{user-full-name} function to return the login name
1933 of the current user as well as mapping from arbitrary user id values
1934 back to login names. The VC code uses this functionality to map from the
1935 uid of the owner of a workfile to the login name in some circumstances.
1937 This will not, for obvious reasons, work if the remote system has a
1938 different set of logins. As such, it is necessary to delegate to the
1939 remote machine the job of determining the login name associated with a
1940 uid.
1942 Unfortunately, with the profusion of distributed management systems such
1943 as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
1944 reliable and portable method for performing this mapping.
1946 Thankfully, the only place in the VC code that depends on the mapping of
1947 a uid to a login name is the @code{vc-file-owner} function. This returns
1948 the login of the owner of the file as a string.
1950 This function has been advised to use the output of @command{ls} on the
1951 remote machine to determine the login name, delegating the problem of
1952 mapping the uid to the login to the remote system which should know more
1953 about it than I do.
1956 @node Back-end Versions
1957 @subsection How VC determines what release your RCS is
1959 VC needs to know what release your revision control binaries you are
1960 running as not all features VC supports are available with older
1961 versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.
1963 The default implementation of VC determines this value the first time it
1964 is needed and then stores the value globally to avoid the overhead of
1965 executing a process and parsing its output each time the information is
1966 needed.
1968 Unfortunately, life is not quite so easy when remote version control
1969 comes into the picture. Each remote machine may have a different version
1970 of the version control tools and, while this is painful, we need to
1971 ensure that unavailable features are not used remotely.
1973 To resolve this issue, @tramp{} currently takes the sledgehammer
1974 approach of making the release values of the revision control tools
1975 local to each @tramp{} buffer, forcing VC to determine these values
1976 again each time a new file is visited.
1978 This has, quite obviously, some performance implications. Thankfully,
1979 most of the common operations performed by VC do not actually require
1980 that the remote version be known. This makes the problem far less
1981 apparent.
1983 Eventually these values will be captured by @tramp{} on a system by
1984 system basis and the results cached to improve performance.
1987 @node Files directories and localnames
1988 @chapter How file names, directories and localnames are mangled and managed.
1990 @menu
1991 * Localname deconstruction::    Breaking a localname into its components.
1992 @end menu
1995 @node Localname deconstruction
1996 @section Breaking a localname into its components.
1998 @tramp{} file names are somewhat different, obviously, to ordinary file
1999 names. As such, the lisp functions @code{file-name-directory} and
2000 @code{file-name-nondirectory} are overridden within the @tramp{}
2001 package.
2003 Their replacements are reasonably simplistic in their approach. They
2004 dissect the filename, call the original handler on the localname and
2005 then rebuild the @tramp{} file name with the result.
2007 This allows the platform specific hacks in the original handlers to take
2008 effect while preserving the @tramp{} file name information.
2011 @node Issues
2012 @chapter Debatable Issues and What Was Decided
2014 @itemize @bullet
2015 @item The uuencode method does not always work.
2017 Due to the design of @tramp{}, the encoding and decoding programs need to
2018 read from stdin and write to stdout.  On some systems, @code{uudecode -o
2019 -} will read stdin and write the decoded file to stdout, on other
2020 systems @code{uudecode -p} does the same thing.  But some systems have
2021 uudecode implementations which cannot do this at all---it is not
2022 possible to call these uudecode implementations with suitable parameters
2023 so that they write to stdout.
2025 Of course, this could be circumvented: the @code{begin foo 644} line
2026 could be rewritten to put in some temporary file name, then
2027 @code{uudecode} could be called, then the temp file could be printed and
2028 deleted.
2030 But I have decided that this is too fragile to reliably work, so on some
2031 systems you'll have to do without the uuencode methods.
2033 @item @tramp{} does not work on XEmacs 20.
2035 This is because it requires the macro @code{with-timeout} which does not
2036 appear to exist in XEmacs 20.  I'm somewhat reluctant to add an
2037 emulation macro to @tramp{}, but if somebody who uses XEmacs 20 steps
2038 forward and wishes to implement and test it, please contact me or the
2039 mailing list.
2041 @item The @tramp{} filename syntax differs between Emacs and XEmacs.
2043 The Emacs maintainers wish to use a unified filename syntax for
2044 Ange-FTP and @tramp{} so that users don't have to learn a new
2045 syntax.  It is sufficient to learn some extensions to the old syntax.
2047 For the XEmacs maintainers, the problems caused from using a unified
2048 filename syntax are greater than the gains.  The XEmacs package system
2049 uses EFS for downloading new packages.  So, obviously, EFS has to be
2050 installed from the start.  If the filenames were unified, @tramp{}
2051 would have to be installed from the start, too.
2053 @end itemize
2055 @node Concept Index
2056 @comment node-name,    next,  previous,      up
2057 @unnumbered Concept Index
2058 @printindex cp
2059 @contents
2060 @c End of tramp.texi - the TRAMP User Manual
2061 @bye
2063 @c TODO
2065 @c * Say something about the .login and .profile files of the remote
2066 @c   shells.
2067 @c * Explain how tramp.el works in principle: open a shell on a remote
2068 @c   host and then send commands to it.
2069 @c * Mention that bookmarks are a cool feature to go along with Tramp.
2070 @c * Make terminology "inline" vs "out-of-band" consistent.
2071 @c   It seems that "external" is also used instead of "out-of-band".
2073 @c * M. Albinus
2074 @c ** Use `filename' resp. `file name' consistently.
2075 @c ** Use `host' resp. `machine' consistently.
2076 @c ** Consistent small or capitalized words especially in menues.