(comment-indent): Be more careful when inserting
[emacs.git] / man / tramp.texi
blob1b4050bc8ea6a7a385577b10d79a3ad18643987f
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 Entries for @command{install-info} to use
21 @dircategory Emacs
22 @direntry
23 * TRAMP: (tramp).                Transparent Remote Access, Multiple Protocol
24                                  Emacs remote file access via rsh and rcp.
25 @end direntry
27 @c Macro to make formatting of the tramp program name consistent.
28 @macro tramp
29 @sc{tramp}
30 @end macro
32 @c Macros for formatting a filename.
33 @c trampfn is for a full filename, trampfnmhp means method, host, localname
34 @c were given, and so on.
35 @macro trampfn(method, user, host, localname)
36 @value{tramp-prefix}@value{method}@value{user}@@@value{host}@value{tramp-postfix}@value{localname}
37 @end macro
39 @copying
40 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003 Free Software
41 Foundation, Inc.
43 @quotation     
44 Permission is granted to copy, distribute and/or modify this document
45 under the terms of the GNU Free Documentation License, Version 1.1 or
46 any later version published by the Free Software Foundation; with no
47 Invariant Sections, with the Front-Cover texts being ``A GNU
48 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
49 license is included in the section entitled ``GNU Free Documentation
50 License'' in the Emacs manual.
52 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
53 this GNU Manual, like GNU software.  Copies published by the Free
54 Software Foundation raise funds for GNU development.''
56 This document is part of a collection distributed under the GNU Free
57 Documentation License.  If you want to distribute this document
58 separately from the collection, you can do so by adding a copy of the
59 license to the document, as described in section 6 of the license.
60 @end quotation
61 @end copying
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.
141 For the developer:
143 * Version Control::             The inner workings of remote version control.
144 * Files directories and localnames::  How file names, directories and localnames are mangled and managed.
145 * Issues::                      Debatable Issues and What Was Decided.
147 @detailmenu
148  --- The Detailed Node Listing ---
150 @ifset tramp-inst
151 Installing @tramp{} with your @value{emacs-name}
153 * Installation parameters::     Parameters in order to control installation.
154 * Load paths::                  How to plug-in @tramp{} into your environment.
156 @end ifset
158 Configuring @tramp{} for use
160 * Connection types::            Types of connections made to remote machines.
161 * Inline methods::              Inline methods.
162 * External transfer methods::   External transfer methods.
163 * Multi-hop Methods::           Connecting to a remote host using multiple hops.
164 * Default Method::              Selecting a default method.
165 * Customizing Methods::         Using Non-Standard Methods.
166 * Customizing Completion::      Selecting config files for user/host name completion.
167 * Remote Programs::             How @tramp{} finds and uses programs on the remote machine.
168 * Remote shell setup::          Remote shell setup hints.
169 * Windows setup hints::         Issues with Cygwin ssh.
170 * Auto-save and Backup::        Auto-save and Backup.
172 Using @tramp
174 * Filename Syntax::             @tramp{} filename conventions.
175 * Multi-hop filename syntax::   Multi-hop filename conventions.
176 * Filename completion::         Filename completion.
177 * Dired::                       Dired.
179 The inner workings of remote version control
181 * Version Controlled Files::    Determining if a file is under version control.
182 * Remote Commands::             Executing the version control commands on the remote machine.
183 * Changed workfiles::           Detecting if the working file has changed.
184 * Checking out files::          Bringing the workfile out of the repository.
185 * Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
187 Things related to Version Control that don't fit elsewhere
189 * Remote File Ownership::       How VC determines who owns a workfile.
190 * Back-end Versions::           How VC determines what release your RCS is.
192 How file names, directories and localnames are mangled and managed
194 * Localname deconstruction::    Breaking a localname into its components.
196 @end detailmenu
197 @end menu
199 @node Overview
200 @chapter An overview of @tramp
201 @cindex overview
203 After the installation of @tramp{} into your @value{emacs-name}, you
204 will be able to access files on remote machines as though they were
205 local.  Access to the remote file system for editing files, version
206 control, and @command{dired} are transparently enabled.
208 Your access to the remote machine can be with the @command{rsh},
209 @command{rlogin}, @command{telnet} programs or with any similar
210 connection method.  This connection must pass ASCII successfully to be
211 usable but need not be 8-bit clean.
213 The package provides support for @command{ssh} connections out of the
214 box, one of the more common uses of the package.  This allows
215 relatively secure access to machines, especially if @command{ftp}
216 access is disabled.
218 The majority of activity carried out by @tramp{} requires only that
219 the remote login is possible and is carried out at the terminal.  In
220 order to access remote files @tramp{} needs to transfer their content
221 to the local machine temporarily.
223 @tramp{} can transfer files between the machines in a variety of ways.
224 The details are easy to select, depending on your needs and the
225 machines in question.
227 The fastest transfer methods (for large files) rely on a remote file
228 transfer package such as @command{rcp}, @command{scp} or
229 @command{rsync}.  The use of these methods is only possible if the
230 file copy command does not ask for a password for the remote machine.
232 If the remote copy methods are not suitable for you, @tramp{} also
233 supports the use of encoded transfers directly through the shell.
234 This requires that the @command{mimencode} or @command{uuencode} tools
235 are available on the remote machine.  These methods are generally
236 faster for small files.
238 Within these limitations, @tramp{} is quite powerful.  It is worth
239 noting that, as of the time of writing, it is far from a polished
240 end-user product.  For a while yet you should expect to run into rough
241 edges and problems with the code now and then.
243 It is finished enough that the developers use it for day to day work but
244 the installation and setup can be a little difficult to master, as can
245 the terminology.
247 @tramp{} is still under active development and any problems you encounter,
248 trivial or major, should be reported to the @tramp{} developers.
249 @xref{Bug Reports}.
252 @subsubheading Behind the scenes
253 @cindex behind the scenes
254 @cindex details of operation
255 @cindex how it works
257 This section tries to explain what goes on behind the scenes when you
258 access a remote file through @tramp{}.
260 Suppose you type @kbd{C-x C-f} and enter part of an @tramp{} file name,
261 then hit @kbd{@key{TAB}} for completion.  Suppose further that this is
262 the first time that @tramp{} is invoked for the host in question.  Here's
263 what happens:
265 @itemize
266 @item
267 @tramp{} discovers that it needs a connection to the host.  So it
268 invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
269 @var{user}} or a similar tool to connect to the remote host.
270 Communication with this process happens through an
271 @value{emacs-name} buffer, that is, the output from the remote end
272 goes into a buffer.
274 @item
275 The remote host may prompt for a login name (for @command{telnet}).  The
276 login name is given in the file name, so @tramp{} sends the login name and
277 a newline.
279 @item
280 The remote host may prompt for a password or pass phrase (for
281 @command{rsh} or for @command{telnet} after sending the login name).
282 @tramp{} displays the prompt in the minibuffer, asking you for the
283 password or pass phrase.
285 You enter the password or pass phrase.  @tramp{} sends it to the remote
286 host, followed by a newline.
288 @item
289 @tramp{} now waits for the shell prompt or for a message that the login
290 failed.
292 If @tramp{} sees neither of them after a certain period of time (a minute,
293 say), then it issues an error message saying that it couldn't find the
294 remote shell prompt and shows you what the remote host has sent.
296 If @tramp{} sees a @samp{login failed} message, it tells you so,
297 aborts the login attempt and allows you to try again.
299 @item
300 Suppose that the login was successful and @tramp{} sees the shell prompt
301 from the remote host.  Now @tramp{} invokes @command{/bin/sh} because
302 Bourne shells and C shells have different command
303 syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
304 shell doesn't recognize @samp{exec /bin/sh} as a valid command.
305 Maybe you use the Scheme shell @command{scsh}@dots{}}
307 After the Bourne shell has come up, @tramp{} sends a few commands to
308 ensure a good working environment.  It turns off echoing, it sets the
309 shell prompt, and a few other things.
311 @item
312 Now the remote shell is up and it good working order.  Remember, what
313 was supposed to happen is that @tramp{} tries to find out what files exist
314 on the remote host so that it can do filename completion.
316 So, @tramp{} basically issues @command{cd} and @command{ls} commands and
317 also sometimes @command{echo} with globbing.  Another command that is
318 often used is @command{test} to find out whether a file is writable or a
319 directory or the like.  The output of each command is parsed for the
320 necessary operation.
322 @item
323 Suppose you are finished with filename completion, have entered @kbd{C-x
324 C-f}, a full file name and hit @kbd{@key{RET}}.  Now comes the time to
325 transfer the file contents from the remote host to the local host so
326 that you can edit them.
328 See above for an explanation of how @tramp{} transfers the file contents.
330 For inline transfers, @tramp{} issues a command like @samp{mimencode -b
331 /path/to/remote/file}, waits until the output has accumulated in the
332 buffer that's used for communication, then decodes that output to
333 produce the file contents.
335 For out-of-band transfers, @tramp{} issues a command like the following:
336 @example
337 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
338 @end example
339 It then reads the local temporary file @file{/tmp/tramp.4711} into a
340 buffer and deletes the temporary file.
342 @item
343 You now edit the buffer contents, blithely unaware of what has happened
344 behind the scenes.  (Unless you have read this section, that is.)  When
345 you are finished, you type @kbd{C-x C-s} to save the buffer.
347 @item
348 Again, @tramp{} transfers the file contents to the remote host either
349 inline or out-of-band.  This is the reverse of what happens when reading
350 the file.
352 @end itemize
354 I hope this has provided you with a basic overview of what happens
355 behind the scenes when you open a file with @tramp{}.
358 @c For the end user
359 @node Obtaining @tramp{}
360 @chapter Obtaining @tramp{}.
361 @cindex obtaining Tramp
363 @tramp{} is freely available on the Internet and the latest release
364 may be downloaded from
365 @uref{http://savannah.nongnu.org/download/tramp/}. This
366 release includes the full documentation and code for @tramp{},
367 suitable for installation.  But Emacs (21.4 or later) includes
368 @tramp{} already, and there is a @tramp{} package for XEmacs, as well.
369 So maybe it is easier to just use those.  But if you want the bleeding
370 edge, read on@dots{...}
372 For the especially brave, @tramp{} is available from CVS.  The CVS
373 version is the latest version of the code and may contain incomplete
374 features or new issues. Use these versions at your own risk.
376 Instructions for obtaining the latest development version of @tramp{}
377 from CVS can be found by going to the Savannah project page at the
378 following URL and then clicking on the CVS link in the navigation bar
379 at the top.
381 @noindent
382 @uref{http://savannah.gnu.org/projects/tramp/}
384 @noindent
385 Or follow the example session below:
387 @example
388 ] @strong{cd ~/@value{emacs-dir}}
389 ] @strong{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp login}
391 (Logging in to anoncvs@@subversions.gnu.org)
392 CVS password: @strong{(just hit RET here)}
393 @dots{}
395 ] @strong{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp co tramp}
396 @end example
398 @noindent
399 You should now have a directory @file{~/@value{emacs-dir}/tramp}
400 containing the latest version of @tramp{}. You can fetch the latest
401 updates from the repository by issuing the command:
403 @example
404 ] @strong{cd ~/@value{emacs-dir}/tramp}
405 ] @strong{cvs update -d}
406 @end example
408 @noindent
409 Once you've got updated files from the CVS repository, you need to run
410 @command{autoconf} in order to get an up-to-date @file{configure}
411 script:
413 @example
414 ] @strong{cd ~/@value{emacs-dir}/tramp}
415 ] @strong{autoconf}
416 @end example
419 @node History
420 @chapter History of @tramp{}
421 @cindex history
422 @cindex development history
424 Development was started end of November 1998.  The package was called
425 @file{rssh.el}, back then.  It only provided one method to access a
426 file, using @command{ssh} to log in to a remote host and using
427 @command{scp} to transfer the file contents.  After a while, the name
428 was changed to @file{rcp.el}, and now it's @tramp{}.  Along the way,
429 many more methods for getting a remote shell and for transferring the
430 file contents were added.  Support for VC was added.
432 The most recent addition of major features were the multi-hop methods
433 added in April 2000 and the unification of @tramp{} and Ange-FTP
434 filenames in July 2002.
436 @c Installation chapter is necessary only in case of standalone
437 @c installation.  Text taken from trampinst.texi.
438 @ifset tramp-inst
439 @installationchapter{}
440 @end ifset
442 @node Configuration
443 @chapter Configuring @tramp{} for use
444 @cindex configuration
446 @cindex default configuration
447 @tramp{} is (normally) fully functional when it is initially
448 installed.  It is initially configured to use the @command{ssh} program
449 to connect to the remote host and to use base-64 encoding (on the
450 remote host, via @command{mimencode}, and on the local host via the
451 built-in support for base-64 encoding in Emacs).
453 On some hosts, there are problems with opening a connection.  These are
454 related to the behavior of the remote shell.  See @xref{Remote shell
455 setup}, for details on this.
457 If you do not wish to use these commands to connect to the remote
458 host, you should change the default connection and transfer method
459 that @tramp uses.  There are several different methods that @tramp{}
460 can use to connect to remote machines and transfer files
461 (@pxref{Connection types}).
464 @menu
465 * Connection types::            Types of connections made to remote machines.
466 * Inline methods::              Inline methods.
467 * External transfer methods::   External transfer methods.
468 * Multi-hop Methods::           Connecting to a remote host using multiple hops.
469 * Default Method::              Selecting a default method.
470 * Customizing Methods::         Using Non-Standard Methods.
471 * Customizing Completion::      Selecting config files for user/host name completion.
472 * Remote Programs::             How @tramp{} finds and uses programs on the remote machine.
473 * Remote shell setup::          Remote shell setup hints.
474 * Windows setup hints::         Issues with Cygwin ssh.
475 * Auto-save and Backup::        Auto-save and Backup.
476 @end menu
479 @node Connection types
480 @section Types of connections made to remote machines.
481 @cindex connection types, overview
483 There are two basic types of transfer methods, each with its own
484 advantages and limitations.  Both types of connection make use of a
485 remote shell access program such as @command{rsh}, @command{ssh} or
486 @command{telnet} to connect to the remote machine.
488 This connection is used to perform many of the operations that @tramp
489 requires to make the remote file system transparently accessible from
490 the local machine. It is only when visiting files that the methods
491 differ.
493 @cindex inline methods
494 @cindex external transfer methods
495 @cindex external methods
496 @cindex out-of-band methods
497 @cindex methods, inline
498 @cindex methods, external transfer
499 @cindex methods, out-of-band
500 Loading or saving a remote file requires that the content of the file
501 be transfered between the two machines. The content of the file can be
502 transfered over the same connection used to log in to the remote
503 machine or the file can be transfered through another connection using
504 a remote copy program such as @command{rcp}, @command{scp} or
505 @command{rsync}.  The former are called @dfn{inline methods}, the
506 latter are called @dfn{out-of-band methods} or @dfn{external transfer
507 methods} (@dfn{external methods} for short).
509 The performance of the external transfer methods is generally better
510 than that of the inline methods, at least for large files.  This is
511 caused by the need to encode and decode the data when transferring
512 inline.
514 The one exception to this rule are the @command{scp} based transfer
515 methods.  While these methods do see better performance when actually
516 transferring files, the overhead of the cryptographic negotiation at
517 startup may drown out the improvement in file transfer times.
519 External transfer methods do require that the remote copy command is not
520 interactive --- that is, the command does not prompt you for a password.
521 If you cannot perform remote copies without a password, you will need to
522 use an inline transfer method to work with @tramp{}.
524 @cindex multi-hop methods
525 @cindex methods, multi-hop
526 A variant of the inline methods are the @dfn{multi-hop methods}.
527 These methods allow you to connect a remote host using a number `hops',
528 each of which connects to a different host.  This is useful if you are
529 in a secured network where you need to go through a bastion host to
530 connect to the outside world.
533 @node Inline methods
534 @section Inline methods
535 @cindex inline methods
536 @cindex methods, inline
538 The inline methods in @tramp{} are quite powerful and can work in
539 situations where you cannot use an external transfer program to connect.
540 Inline methods are the only methods that work when connecting to the
541 remote machine via telnet.  (There are also strange inline methods which
542 allow you to transfer files between @emph{user identities} rather than
543 hosts, see below.)
545 These methods depend on the existence of a suitable encoding and
546 decoding command on remote machine.  Locally, @tramp{} may be able to use
547 features of Emacs to decode and encode the files or it may require
548 access to external commands to perform that task.
550 @cindex uuencode
551 @cindex mimencode
552 @cindex base-64 encoding
553 @tramp{} checks the availability and usability of commands like
554 @command{mimencode} (part of the @command{metamail} package) or
555 @command{uuencode} on the remote host.  The first reliable command
556 will be used.  The search path can be customized, see @ref{Remote
557 Programs}.
559 If both commands aren't available on the remote host, @tramp{}
560 transfers a small piece of Perl code to the remote host, and tries to
561 apply it for encoding and decoding.
564 @table @asis
565 @item @option{rsh}
566 @cindex method rsh
567 @cindex rsh method
569 Connect to the remote host with @command{rsh}.  Due to the unsecure
570 connection it is recommended for very local host topology only.
573 @item @option{ssh}
574 @cindex method ssh
575 @cindex ssh method
577 Connect to the remote host with @command{ssh}.  This is identical to
578 the previous option except that the @command{ssh} package is used,
579 making the connection more secure.
581 There are also two variants, @option{ssh1} and @option{ssh2}, that
582 call @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
583 explicitly select whether you want to use the SSH protocol version 1
584 or 2 to connect to the remote host.  (You can also specify in
585 @file{~/.ssh/config}, the SSH configuration file, which protocol
586 should be used, and use the regular @option{ssh} method.)
588 Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
589 @command{ssh1} and @command{ssh2} commands explicitly.  If you don't
590 know what these are, you do not need these options.
592 All the methods based on @command{ssh} have an additional kludgy
593 feature: you can specify a host name which looks like @file{host#42}
594 (the real host name, then a hash sign, then a port number).  This
595 means to connect to the given host but to also pass @code{-p 42} as
596 arguments to the @command{ssh} command.
599 @item @option{telnet}
600 @cindex method telnet
601 @cindex telnet method
603 Connect to the remote host with @command{telnet}.  This is as unsecure
604 as the @option{rsh} method.
607 @item @option{su}
608 @cindex method su
609 @cindex su method
611 This method does not connect to a remote host at all, rather it uses
612 the @command{su} program to allow you to edit files as another user.
615 @item @option{sudo}
616 @cindex method sudo
617 @cindex sudo method
619 This is similar to the @option{su} method, but it uses @command{sudo}
620 rather than @command{su} to become a different user.
622 Note that @command{sudo} must be configured to allow you to start a
623 shell as the user.  It would be nice if it was sufficient if
624 @command{ls} and @command{mimencode} were allowed, but that is not
625 easy to implement, so I haven't got around to it, yet.
628 @item @option{sshx}
629 @cindex method sshx
630 @cindex sshx method
631 @cindex Cygwin (with sshx method)
633 As you expect, this is similar to @option{ssh}, only a little
634 different.  Whereas @option{ssh} opens a normal interactive shell on
635 the remote host, this option uses @samp{ssh -t -t @var{host} -l
636 @var{user} /bin/sh} to open a connection.  This is useful for users
637 where the normal login shell is set up to ask them a number of
638 questions when logging in.  This procedure avoids these questions, and
639 just gives @tramp{} a more-or-less `standard' login shell to work
640 with.
642 Note that this procedure does not eliminate questions asked by
643 @command{ssh} itself.  For example, @command{ssh} might ask ``Are you
644 sure you want to continue connecting?'' if the host key of the remote
645 host is not known.  @tramp{} does not know how to deal with such a
646 question (yet), therefore you will need to make sure that you can log
647 in without such questions.
649 This is also useful for Windows users where @command{ssh}, when
650 invoked from an Emacs buffer, tells them that it is not allocating a
651 pseudo tty.  When this happens, the login shell is wont to not print
652 any shell prompt, which confuses @tramp{} mightily.  For reasons
653 unknown, some Windows ports for @command{ssh} (maybe the Cygwin one)
654 require the doubled @samp{-t} option.
656 This supports the @samp{-p} kludge.
659 @item @option{krlogin}
660 @cindex method krlogin
661 @cindex km krlogin
662 @cindex Kerberos (with krlogin method)
664 This method is also similar to @option{ssh}.  It only uses the
665 @command{krlogin -x} command to log in to the remote host.
668 @item @option{plink}
669 @cindex method plink
670 @cindex plink method
672 This method is mostly interesting for Windows users using the PuTTY
673 implementation of SSH.  It uses @samp{plink -ssh} to log in to the
674 remote host.
676 CCC: Do we have to connect to the remote host once from the command
677 line to accept the SSH key?  Maybe this can be made automatic?
679 CCC: Does @command{plink} support the @samp{-p} option?  @tramp{} will
680 support that, anyway.
682 @end table
686 @node External transfer methods
687 @section External transfer methods
688 @cindex methods, external transfer
689 @cindex methods, out-of-band
690 @cindex external transfer methods
691 @cindex out-of-band methods
693 The external transfer methods operate through multiple channels, using
694 the remote shell connection for many actions while delegating file
695 transfers to an external transfer utility.
697 This saves the overhead of encoding and decoding that multiplexing the
698 transfer through the one connection has with the inline methods.
700 If you want to use an external transfer method you @emph{must} be able
701 to execute the transfer utility to copy files to and from the remote
702 machine without any interaction.
704 @cindex ssh-agent
705 This means that you will need to use @command{ssh-agent} if you use the
706 @command{scp} program for transfers, or maybe your version of
707 @command{scp} accepts a password on the command line.@footnote{PuTTY's
708 @command{pscp} allows you to specify the password on the command line.}
709 If you use @command{rsync} via @command{ssh} then the same rule must
710 apply to that connection.
712 If you cannot get @command{scp} to run without asking for a password but
713 would still like to use @command{ssh} to secure your connection, have a
714 look at the @command{ssh} based inline methods.
717 @table @asis
718 @item @option{rcp}  ---  @command{rsh} and @command{rcp}
719 @cindex method rcp
720 @cindex rcp method
721 @cindex rcp (with rcp method)
722 @cindex rsh (with rcp method)
724 This method uses the @command{rsh} and @command{rcp} commands to connect
725 to the remote machine and transfer files. This is probably the fastest
726 connection method available.
729 @item @option{scp}  ---  @command{ssh} and @command{scp}
730 @cindex method scp
731 @cindex scp method
732 @cindex scp (with scp method)
733 @cindex ssh (with scp method)
735 Using @command{ssh} to connect to the remote host and @command{scp} to
736 transfer files between the machines is the best method for securely
737 connecting to a remote machine and accessing files.
739 The performance of this option is also quite good. It may be slower than
740 the inline methods when you often open and close small files however.
741 The cost of the cryptographic handshake at the start of an @command{scp}
742 session can begin to absorb the advantage that the lack of encoding and
743 decoding presents.
745 There are also two variants, @option{scp1} and @option{scp2}, that
746 call @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
747 explicitly select whether you want to use the SSH protocol version 1
748 or 2 to connect to the remote host.  (You can also specify in
749 @file{~/.ssh/config}, the SSH configuration file, which protocol
750 should be used, and use the regular @option{ssh} method.)
752 Two other variants, @option{scp1_old} and @option{scp2_old}, use the
753 @command{ssh1} and @command{ssh2} commands explicitly.  If you don't
754 know what these are, you do not need these options.
756 All the @command{ssh} based methods support the kludgy @samp{-p}
757 feature where you can specify a port number to connect to in the host
758 name.  For example, the host name @file{host#42} tells @tramp{} to
759 specify @samp{-p 42} in the argument list for @command{ssh}.
762 @item @option{rsync}  ---  @command{ssh} and @command{rsync}
763 @cindex method rsync
764 @cindex rsync method
765 @cindex rsync (with rsync method)
766 @cindex ssh (with rsync method)
768 Using the @command{ssh} command to connect securely to the remote
769 machine and the @command{rsync} command to transfer files is almost
770 identical to the @option{scp} method.
772 While @command{rsync} performs much better than @command{scp} when
773 transferring files that exist on both hosts, this advantage is lost if
774 the file exists only on one side of the connection.
776 The @command{rsync} based method may be considerably faster than the
777 @command{rcp} based methods when writing to the remote system. Reading
778 files to the local machine is no faster than with a direct copy.
780 This method supports the @samp{-p} hack.
783 @item @option{scpx} --- @command{ssh} and @command{scp}
784 @cindex method scpx
785 @cindex scpx method
786 @cindex scp (with scpx method)
787 @cindex ssh (with scpx method)
788 @cindex Cygwin (with scpx method)
790 As you expect, this is similar to @option{scp}, only a little
791 different.  Whereas @option{scp} opens a normal interactive shell on
792 the remote host, this option uses @samp{ssh -t -t @var{host} -l
793 @var{user} /bin/sh} to open a connection.  This is useful for users
794 where the normal login shell is set up to ask them a number of
795 questions when logging in.  This procedure avoids these questions, and
796 just gives @tramp{} a more-or-less `standard' login shell to work
797 with.
799 This is also useful for Windows users where @command{ssh}, when
800 invoked from an Emacs buffer, tells them that it is not allocating a
801 pseudo tty.  When this happens, the login shell is wont to not print
802 any shell prompt, which confuses @tramp{} mightily.  Maybe this
803 applies to the Cygwin port of SSH.
805 This method supports the @samp{-p} hack.
808 @item @option{pscp} --- @command{plink} and @command{pscp}
809 @cindex method pscp
810 @cindex pscp method
811 @cindex pscp (with pscp method)
812 @cindex plink (with pscp method)
813 @cindex PuTTY (with pscp method)
815 This method is similar to @option{scp}, but it uses the
816 @command{plink} command to connect to the remote host, and it uses
817 @command{pscp} for transferring the files.  These programs are part
818 of PuTTY, an SSH implementation for Windows.
820 CCC: Does @command{plink} support the @samp{-p} hack?
823 @item @option{fcp} --- @command{fsh} and @command{fcp}
824 @cindex method fcp
825 @cindex fcp method
826 @cindex fsh (with fcp method)
827 @cindex fcp (with fcp method)
829 This method is similar to @option{scp}, but it uses the @command{fsh}
830 command to connect to the remote host, and it uses @command{fcp} for
831 transferring the files.  @command{fsh/fcp} are a front-end for
832 @command{ssh} which allow for reusing the same @command{ssh} session
833 for submitting several commands.  This avoids the startup overhead of
834 @command{scp} (which has to establish a secure connection whenever it
835 is called).  Note, however, that you can also use one of the inline
836 methods to achieve a similar effect.
838 This method uses the command @samp{fsh @var{host} -l @var{user}
839 /bin/sh -i} to establish the connection, it does not work to just say
840 @command{fsh @var{host} -l @var{user}}.
842 @cindex method fsh
843 @cindex fsh method
844 There is no inline method using @command{fsh} as the multiplexing
845 provided by the program is not very useful in our context.  @tramp{}
846 opens just one connection to the remote host and then keeps it open,
847 anyway.
850 @ifset emacs
851 @item @option{ftp}
852 @cindex method ftp
853 @cindex ftp method
855 This is not a native @tramp{} method. Instead of, it forwards all
856 requests to @value{ftp-package-name}.
857 @end ifset
860 @item @option{smb} --- @command{smbclient}
861 @cindex method smb
862 @cindex smb method
864 This is another not natural @tramp{} method.  It uses the
865 @command{smbclient} command on different Unices in order to connect to
866 an SMB server.  An SMB server might be a Samba (or CIFS) server on
867 another UNIX host or, more interesting, a host running MS Windows.  So
868 far, it is tested towards MS Windows NT, MS Windows 2000, and MS
869 Windows XP.
871 The first directory in the localname must be a share name on the remote
872 host.  Remember, that the @code{$} character in which default shares
873 usually end, must be written @code{$$} due to environment variable
874 substitution in file names.  If no share name is given (i.e. remote
875 directory @code{/}), all available shares are listed.
877 Since authorization is done on share level, you will be prompted
878 always for a password if you access another share on the same host.
879 Due to security reasons, the password is not cached.
881 MS Windows uses for authorization both a user name and a domain name.
882 Because of this, the @tramp{} syntax has been extended: you can
883 specify a user name which looks like @code{user%domain} (the real user
884 name, then a percent sign, then the domain name).  So, to connect to
885 the machine @code{melancholia} as user @code{daniel} of the domain
886 @code{BIZARRE}, and edit @file{.emacs} in the home directory (share
887 @code{daniel$}) I would specify the filename
888 @file{@value{tramp-prefix}smb@value{tramp-postfix-single-hop}daniel%BIZARRE@@melancholia@value{tramp-postfix}/daniel$$/.emacs}.
890 The domain name as well as the user name are optional.  If no user
891 name is specified at all, the anonymous user (without password
892 prompting) is assumed.  This is different from all other @tramp{}
893 methods, where in such a case the local user name is taken.
895 The @option{smb} method supports the @samp{-p} hack.
897 @strong{Please note:} If Emacs runs locally under MS Windows, this
898 method isn't available.  Instead of, you can use UNC file names like
899 @file{//melancholia/daniel$$/.emacs}.  The only disadvantage is that
900 there's no possiblity to specify another user name.
902 @end table
904 @node Multi-hop Methods
905 @section Connecting to a remote host using multiple hops
906 @cindex multi-hop methods
907 @cindex methods, multi-hop
909 Sometimes, the methods described before are not sufficient.  Sometimes,
910 it is not possible to connect to a remote host using a simple command.
911 For example, if you are in a secured network, you might have to log in
912 to a `bastion host' first before you can connect to the outside world.
913 Of course, the target host may also require a bastion host.  The format
914 of multi-hop filenames is slightly different than the format of normal
915 @tramp{} methods.
917 @cindex method multi
918 @cindex multi method
919 A multi-hop file name specifies a method, a number of hops, and a
920 localname (path name on the remote system).  The method name is always
921 @option{multi}.
923 Each hop consists of a @dfn{hop method} specification, a user name and
924 a host name.  The hop method can be an inline method only.  The
925 following hop methods are (currently) available:
927 @table @option
928 @item telnet
929 @cindex hop method telnet
930 @cindex telnet hop method
932 Uses the well-known @command{telnet} program to connect to the host.
933 Whereas user name and host name are supplied in the file name, the
934 user is queried for the password.
936 @item rsh
937 @cindex hop method rsh
938 @cindex rsh hop method
940 This uses @command{rsh} to connect to the host.  You do not need to
941 enter a password unless @command{rsh} explicitly asks for it.
943 @item ssh
944 @cindex hop method ssh
945 @cindex ssh hop method
947 This uses @command{ssh} to connect to the host.  You might have to enter
948 a password or a pass phrase.
950 @item su
951 @cindex hop method su
952 @cindex su hop method
954 This method does not actually contact a different host, but it allows
955 you to become a different user on the host you're currently on.  This
956 might be useful if you want to edit files as root, but the remote host
957 does not allow remote root logins.  In this case you can use
958 @option{telnet}, @option{rsh} or @option{ssh} to connect to the
959 remote host as a non-root user, then use an @option{su} hop to become
960 root.  But @option{su} need not be the last hop in a sequence, you could
961 also use it somewhere in the middle, if the need arises.
963 Even though you @emph{must} specify both user and host with an
964 @option{su} hop, the host name is ignored and only the user name is
965 used.
967 @item sudo
968 @cindex hop method sudo
969 @cindex sudo hop method
971 This is similar to the @option{su} hop, except that it uses
972 @command{sudo} rather than @command{su} to become a different user.
974 @end table
976 Some people might wish to use port forwarding with @command{ssh} or
977 maybe they have to use a nonstandard port.  This can be accomplished
978 by putting a stanza in @file{~/.ssh/config} for the account which
979 specifies a different port number for a certain host name.  But it can
980 also be accomplished within @tramp{}, by adding a multi-hop method.
981 For example:
983 @lisp
984 (add-to-list
985  'tramp-multi-connection-function-alist
986  '("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n"))
987 @end lisp
989 Now you can use an @code{sshf} hop which connects to port 4400 instead of
990 the standard port.
993 @node Default Method
994 @section Selecting a default method
995 @cindex default method
997 @vindex tramp-default-method
998 When you select an appropriate transfer method for your typical usage
999 you should set the variable @var{tramp-default-method} to reflect that
1000 choice.  This variable controls which method will be used when a method
1001 is not specified in the @tramp{} file name.  For example:
1003 @lisp
1004 (setq tramp-default-method "scp")
1005 @end lisp
1007 @vindex tramp-default-method-alist
1008 You can also specify different methods for certain user/host
1009 combinations, via the variable @var{tramp-default-method-alist}.  For
1010 example, the following two lines specify to use the @option{ssh}
1011 method for all user names matching @samp{john} and the @option{rsync}
1012 method for all host names matching @samp{lily}.  The third line
1013 specifies to use the @option{su} method for the user @samp{root} on
1014 the machine @samp{localhost}.
1016 @lisp
1017 (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
1018 (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1019 (add-to-list 'tramp-default-method-alist
1020              '("\\`localhost\\'" "\\`root\\'" "su"))
1021 @end lisp
1023 @noindent
1024 See the documentation for the variable
1025 @var{tramp-default-method-alist} for more details.
1027 External transfer methods are normally preferable to inline transfer
1028 methods, giving better performance. They may not be useful if you use
1029 many remote machines where you cannot log in without a password.
1031 @xref{Inline methods}.
1032 @xref{External transfer methods}.
1033 @xref{Multi-hop Methods}.
1035 Another consideration with the selection of transfer methods is the
1036 environment you will use them in and, especially when used over the
1037 Internet, the security implications of your preferred method.
1039 The @command{rsh} and @command{telnet} methods send your password as
1040 plain text as you log in to the remote machine, as well as transferring
1041 the files in such a way that the content can easily be read from other
1042 machines.
1044 If you need to connect to remote systems that are accessible from the
1045 Internet, you should give serious thought to using @command{ssh} based
1046 methods to connect. These provide a much higher level of security,
1047 making it a non-trivial exercise for someone to obtain your password or
1048 read the content of the files you are editing.
1050 @node Customizing Methods
1051 @section Using Non-Standard Methods
1052 @cindex customizing methods
1053 @cindex using non-standard methods
1054 @cindex create your own methods
1056 There is a variable @code{tramp-methods} which you can change if the
1057 predefined methods don't seem right.
1059 For the time being, I'll refer you to the Lisp documentation of that
1060 variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1063 @node Customizing Completion
1064 @section Selecting config files for user/host name completion
1065 @cindex customizing completion
1066 @cindex selecting config files
1067 @vindex tramp-completion-function-alist
1069 The variable @code{tramp-completion-function-alist} is intended to
1070 customize which files are taken into account for user and host name
1071 completion (@pxref{Filename completion}).  For every method, it keeps
1072 a set of configuration files, accompanied by a Lisp function able to
1073 parse that file.  Entries in @code{tramp-completion-function-alist}
1074 have the form (@var{method} @var{pair1} @var{pair2} ...).
1076 Each @var{pair} is composed of (@var{function} @var{file}).
1077 @var{function} is responsible to extract user names and host names
1078 from @var{file} for completion.  There are two functions which access
1079 this variable:
1081 @defun tramp-get-completion-function method
1082 This function returns the list of completion functions for @var{method}.
1084 Example:
1085 @example
1086 (tramp-get-completion-function "rsh")
1088      @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1089          (tramp-parse-rhosts "~/.rhosts"))
1090 @end example
1091 @end defun
1093 @defun tramp-set-completion-function method function-list
1094 This function sets @var{function-list} as list of completion functions
1095 for @var{method}. 
1097 Example:
1098 @example
1099 (tramp-set-completion-function "ssh"
1100  '((tramp-parse-sconfig "/etc/ssh_config")
1101    (tramp-parse-sconfig "~/.ssh/config")))
1103      @result{} ((tramp-parse-sconfig "/etc/ssh_config")
1104          (tramp-parse-sconfig "~/.ssh/config"))
1105 @end example
1106 @end defun
1108 The following predefined functions parsing configuration files exist:
1110 @table @asis
1111 @item @code{tramp-parse-rhosts}
1112 @findex tramp-parse-rhosts
1114 This function parses files which are syntactical equivalent to
1115 @file{~/.rhosts}.  It returns both host names and user names, if
1116 specified.
1118 @item @code{tramp-parse-shosts}
1119 @findex tramp-parse-shosts
1121 This function parses files which are syntactical equivalent to
1122 @file{~/.ssh/known_hosts}.  Since there are no user names specified
1123 in such files, it can return host names only.
1125 @item @code{tramp-parse-sconfig}
1126 @findex tramp-parse-shosts
1128 This function returns the host nicnames defined by @code{Host} entries
1129 in @file{~/.ssh/config} style files.
1131 @item @code{tramp-parse-hosts}
1132 @findex tramp-parse-hosts
1134 A function dedicated to @file{/etc/hosts} style files.  It returns
1135 host names only.
1137 @item @code{tramp-parse-passwd}
1138 @findex tramp-parse-passwd
1140 A function which parses @file{/etc/passwd} like files.  Obviously, it
1141 can return user names only.
1143 @item @code{tramp-parse-netrc}
1144 @findex tramp-parse-netrc
1146 Finally, a function which parses @file{~/.netrc} like files.
1147 @end table
1149 If you want to keep your own data in a file, with your own structure,
1150 you might provide such a function as well.  This function must meet
1151 the following conventions:
1153 @defun my-tramp-parse file
1154 @var{file} must be either a file name on your host, or @code{nil}. The
1155 function must return a list of (@var{user} @var{host}), which are
1156 taken as candidates for user and host name completion.
1158 Example:
1159 @example
1160 (my-tramp-parse "~/.my-tramp-hosts")
1162      @result{} ((nil "toto") ("daniel" "melancholia"))
1163 @end example
1164 @end defun
1167 @node Remote Programs
1168 @section How @tramp{} finds and uses programs on the remote machine.
1170 @tramp{} depends on a number of programs on the remote host in order to
1171 function, including @command{ls}, @command{test}, @command{find} and
1172 @command{cat}.
1174 In addition to these required tools, there are various tools that may be
1175 required based on the connection method. See @ref{Inline methods} and
1176 @ref{External transfer methods} for details on these.
1178 Certain other tools, such as @command{perl} (or @command{perl5}) and
1179 @command{grep} will be used if they can be found. When they are
1180 available, they are used to improve the performance and accuracy of
1181 remote file access.
1183 @vindex tramp-remote-path
1184 When @tramp{} connects to the remote machine, it searches for the
1185 programs that it can use. The variable @var{tramp-remote-path} controls
1186 the directories searched on the remote machine.
1188 By default, this is set to a reasonable set of defaults for most
1189 machines. It is possible, however, that your local (or remote ;) system
1190 administrator has put the tools you want in some obscure local
1191 directory.
1193 In this case, you can still use them with @tramp{}. You simply need to
1194 add code to your @file{.emacs} to add the directory to the remote path.
1195 This will then be searched by @tramp{} when you connect and the software
1196 found.
1198 To add a directory to the remote search path, you could use code such
1201 @lisp
1202 @i{;; We load @tramp{} to define the variable.}
1203 (require 'tramp)
1204 @i{;; We have @command{perl} in "/usr/local/perl/bin"}
1205 (add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1206 @end lisp
1209 @node Remote shell setup
1210 @comment  node-name,  next,  previous,  up
1211 @section Remote shell setup hints
1212 @cindex remote shell setup
1213 @cindex @file{.profile} file
1214 @cindex @file{.login} file
1215 @cindex shell init files
1217 As explained in the @ref{Overview} section, @tramp{} connects to the
1218 remote host and talks to the shell it finds there.  Of course, when you
1219 log in, the shell executes its init files.  Suppose your init file
1220 requires you to enter the birth date of your mother; clearly @tramp{}
1221 does not know this and hence fails to log you in to that host.
1223 There are different possible strategies for pursuing this problem.  One
1224 strategy is to enable @tramp{} to deal with all possible situations.
1225 This is a losing battle, since it is not possible to deal with
1226 @emph{all} situations.  The other strategy is to require you to set up
1227 the remote host such that it behaves like @tramp{} expect.  This might
1228 be inconvenient because you have to invest a lot of effort into shell
1229 setup before you can begin to use @tramp{}.
1231 The package, therefore, pursues a combined approach.  It tries to figure
1232 out some of the more common setups, and only requires you to avoid
1233 really exotic stuff.  For example, it looks through a list of
1234 directories to find some programs on the remote host.  And also, it
1235 knows that it is not obvious how to check whether a file exists, and
1236 therefore it tries different possibilities.  (On some hosts and shells,
1237 the command @code{test -e} does the trick, on some hosts the shell
1238 builtin doesn't work but the program @code{/usr/bin/test -e} or
1239 @code{/bin/test -e} works.  And on still other hosts, @code{ls -d} is
1240 the right way to do this.)
1242 Below you find a discussion of a few things that @tramp{} does not deal
1243 with, and that you therefore have to set up correctly.
1245 @table @asis
1246 @item @var{shell-prompt-pattern}
1247 @vindex shell-prompt-pattern
1249 After logging in to the remote host, @tramp{} has to wait for the remote
1250 shell startup to finish before it can send commands to the remote
1251 shell.  The strategy here is to wait for the shell prompt.  In order to
1252 recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1253 to be set correctly to recognize the shell prompt on the remote host.
1255 Note that @tramp{} requires the match for @code{shell-prompt-pattern}
1256 to be at the end of the buffer.  Many people have something like the
1257 following as the value for the variable: @code{"^[^>$][>$] *"}.  Now
1258 suppose your shell prompt is @code{a <b> c $ }.  In this case,
1259 @tramp{} recognizes the @code{>} character as the end of the prompt,
1260 but it is not at the end of the buffer.
1262 @item @var{tramp-shell-prompt-pattern}
1263 @vindex tramp-shell-prompt-pattern
1265 This regular expression is used by @tramp{} in the same way as
1266 @code{shell-prompt-pattern}, to match prompts from the remote shell.
1267 This second variable exists because the prompt from the remote shell
1268 might be different from the prompt from a local shell --- after all,
1269 the whole point of @tramp{} is to log in to remote hosts as a
1270 different user.  The default value of
1271 @code{tramp-shell-prompt-pattern} is the same as the default value of
1272 @code{shell-prompt-pattern}, which is reported to work well in many
1273 circumstances.
1275 @item @code{tset} and other questions
1276 @cindex Unix command tset
1277 @cindex tset Unix command
1279 Some people invoke the @code{tset} program from their shell startup
1280 scripts which asks the user about the terminal type of the shell.
1281 Maybe some shells ask other questions when they are started.  @tramp{}
1282 does not know how to answer these questions.  There are two approaches
1283 for dealing with this problem.  One approach is to take care that the
1284 shell does not ask any questions when invoked from @tramp{}.  You can
1285 do this by checking the @code{TERM} environment variable, it will be
1286 set to @code{dumb} when connecting.
1288 @vindex tramp-terminal-type
1289 The variable @code{tramp-terminal-type} can be used to change this value
1290 to @code{dumb}.
1292 The other approach is to teach @tramp{} about these questions.  See
1293 the variables @code{tramp-actions-before-shell} and
1294 @code{tramp-multi-actions} (for multi-hop connections).
1296 @end table
1299 @node Auto-save and Backup
1300 @section Auto-save and Backup configuration
1301 @cindex auto-save
1302 @cindex backup
1303 @vindex backup-directory-alist
1305 Explaining auto-save is still to do.
1307 Normally, Emacs writes backup files to the same directory as the
1308 original files, but this behavior can be changed via the variable
1309 @code{backup-directory-alist}.  In connection with @tramp{}, this can
1310 have unexpected side effects.  Suppose that you specify that all backups
1311 should go to the directory @file{~/.emacs.d/backups/}, and then you edit
1312 the file @file{/su:root@@localhost:/etc/secretfile}.  The effect is that
1313 the backup file will be owned by you and not by root, thus possibly
1314 enabling others to see it even if they were not intended to see it.
1316 When @code{backup-directory-alist} is nil (the default), such problems
1317 do not occur.
1319 If you wish to customize the variable, the workaround is to include
1320 special settings for Tramp files.  For example, the following statement
1321 effectively `turns off' the effect of @code{backup-directory-alist} for
1322 @tramp{} files:
1324 @lisp
1325 (require 'tramp)
1326 (add-to-list 'backup-directory-alist
1327              (cons tramp-file-name-regexp nil))
1328 @end lisp
1331 @node Windows setup hints
1332 @section Issues with Cygwin ssh
1333 @cindex Cygwin, issues
1335 This section needs a lot of work!  Please help.
1337 @cindex method sshx with Cygwin
1338 @cindex sshx method with Cygwin
1339 If you use the Cygwin installation of ssh (you have to explicitly select
1340 it in the installer), then it should work out of the box to just select
1341 @code{sshx} as the connection method.  You can find information about
1342 setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}.
1344 @cindex method scpx with Cygwin
1345 @cindex scpx method with Cygwin
1346 If you wish to use the @code{scpx} connection method, then you might
1347 have the problem that Emacs calls @code{scp} with a Windows filename
1348 such as @code{c:/foo}.  The Cygwin version of @code{scp} does not know
1349 about Windows filenames and interprets this as a remote filename on the
1350 host @code{c}.
1352 One possible workaround is to write a wrapper script for @code{scp}
1353 which converts the Windows filename to a Cygwinized filename.
1355 I guess that another workaround is to run Emacs under Cygwin, or to run
1356 a Cygwinized Emacs.
1358 @cindex Cygwin and ssh-agent
1359 @cindex SSH_AUTH_SOCK and Emacs on Windows
1360 If you want to use either @code{ssh} based method on Windows, then you
1361 might encounter problems with @code{ssh-agent}.  Using this program,
1362 you can avoid typing the pass-phrase every time you log in (and the
1363 @code{scpx} method more or less requires you to use @code{ssh-agent}
1364 because it does not allow you to type a password or pass-phrase).
1365 However, if you start Emacs from a desktop shortcut, then the
1366 environment variable @code{SSH_AUTH_SOCK} is not set and so Emacs and
1367 thus @tramp{} and thus @code{ssh} and @code{scp} started from @tramp{}
1368 cannot communicate with @code{ssh-agent}.  It works better to start
1369 Emacs from the shell.
1371 If anyone knows how to start @code{ssh-agent} under Windows in such a
1372 way that desktop shortcuts can profit, please holler.  I don't really
1373 know anything at all about Windows@dots{}
1376 @node Usage
1377 @chapter Using @tramp
1378 @cindex using @tramp
1380 Once you have installed @tramp{} it will operate fairly transparently. You
1381 will be able to access files on any remote machine that you can log in
1382 to as though they were local.
1384 Files are specified to @tramp{} using a formalized syntax specifying the
1385 details of the system to connect to.  This is similar to the syntax used
1386 by the @value{ftp-package-name} package.
1388 @cindex type-ahead
1389 Something that might happen which surprises you is that Emacs
1390 remembers all your keystrokes, so if you see a password prompt from
1391 Emacs, say, and hit @kbd{@key{RET}} twice instead of once, then the
1392 second keystroke will be processed by Emacs after @tramp{} has done
1393 its thing.  Why, this type-ahead is normal behavior, you say.  Right
1394 you are, but be aware that opening a remote file might take quite a
1395 while, maybe half a minute when a connection needs to be opened.
1396 Maybe after half a minute you have already forgotten that you hit that
1397 key!
1399 @menu
1400 * Filename Syntax::             @tramp{} filename conventions.
1401 * Multi-hop filename syntax::   Multi-hop filename conventions.
1402 * Filename completion::         Filename completion.
1403 * Dired::                       Dired.
1404 @end menu
1407 @node Filename Syntax
1408 @section @tramp{} filename conventions
1409 @cindex filename syntax
1410 @cindex filename examples
1412 To access the file @var{localname} on the remote machine @var{machine} you
1413 would specify the filename
1414 @file{@value{tramp-prefix}@var{machine}@value{tramp-postfix}@var{localname}}.
1415 This will connect to @var{machine} and transfer the file using the
1416 default method.  @xref{Default Method}.
1418 Some examples of @tramp{} filenames are shown below.
1420 @table @file
1421 @item @value{tramp-prefix}melancholia@value{tramp-postfix}.emacs
1422 Edit the file @file{.emacs} in your home directory on the machine
1423 @code{melancholia}.
1425 @item @value{tramp-prefix}melancholia.danann.net@value{tramp-postfix}.emacs
1426 This edits the same file, using the fully qualified domain name of
1427 the machine.
1429 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~/.emacs
1430 This also edits the same file --- the @file{~} is expanded to your
1431 home directory on the remote machine, just like it is locally.
1433 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~daniel/.emacs
1434 This edits the file @file{.emacs} in the home directory of the user
1435 @code{daniel} on the machine @code{melancholia}. The @file{~<user>}
1436 construct is expanded to the home directory of that user on the remote
1437 machine.
1439 @item @value{tramp-prefix}melancholia@value{tramp-postfix}/etc/squid.conf
1440 This edits the file @file{/etc/squid.conf} on the machine
1441 @code{melancholia}.
1443 @end table
1445 Unless you specify a different name to use, @tramp{} will use the
1446 current local user name as the remote user name to log in with. If you
1447 need to log in as a different user, you can specify the user name as
1448 part of the filename.
1450 To log in to the remote machine as a specific user, you use the syntax
1451 @file{@value{tramp-prefix}@var{user}@@@var{machine}@value{tramp-postfix}/@var{path/to.file}}.
1452 That means that connecting to @code{melancholia} as @code{daniel} and
1453 editing @file{.emacs} in your home directory you would specify
1454 @file{@value{tramp-prefix}daniel@@melancholia@value{tramp-postfix}.emacs}.
1456 It is also possible to specify other file transfer methods
1457 (@pxref{Default Method}) as part of the filename.
1458 @ifset emacs
1459 This is done by putting the method before the user and host name, as
1461 @file{@value{tramp-prefix}@var{method}@value{tramp-postfix-single-hop}}
1462 (Note the trailing colon).
1463 @end ifset
1464 @ifset xemacs
1465 This is done by replacing the initial
1466 @file{@value{tramp-prefix}} with
1467 @file{@value{tramp-prefix}<method>@value{tramp-postfix-single-hop}}.
1468 (Note the trailing slash!).
1469 @end ifset
1470 The user, machine and file specification remain the same.
1472 So, to connect to the machine @code{melancholia} as @code{daniel},
1473 using the @option{su} method to transfer files, and edit @file{.emacs}
1474 in my home directory I would specify the filename
1475 @file{@value{tramp-prefix}su@value{tramp-postfix-single-hop}daniel@@melancholia@value{tramp-postfix}.emacs}.
1478 @node Multi-hop filename syntax
1479 @section Multi-hop filename conventions
1480 @cindex filename syntax for multi-hop files
1481 @cindex multi-hop filename syntax
1483 The syntax of multi-hop file names is necessarily slightly different
1484 than the syntax of other @tramp{} file names.  Here's an example
1485 multi-hop file name, first in Emacs syntax and then in XEmacs syntax:
1487 @example
1488 @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
1489 @end example
1491 This is quite a mouthful.  So let's go through it step by step.  The
1492 file name consists of three parts.
1493 @ifset emacs
1494 The parts are separated by colons
1495 @end ifset
1496 @ifset xemacs
1497 The parts are separated by slashes and square brackets.
1498 @end ifset
1499 The first part is @file{@value{tramp-prefix}multi}, the method
1500 specification.  The second part is
1501 @file{rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host}
1502 and specifies the hops.  The final part is @file{/path/to.file} and
1503 specifies the file name on the remote host.
1505 The first part and the final part should be clear.  See @ref{Multi-hop
1506 Methods}, for a list of alternatives for the method specification.
1508 The second part can be subdivided again into components, so-called
1509 hops.  In the above file name, there are two hops,
1510 @file{rsh@value{tramp-postfix-multi-hop}out@@gate} and
1511 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}.
1513 Each hop can @emph{again} be subdivided into (three) components, the
1514 @dfn{hop method}, the @dfn{user name} and the @dfn{host name}.  The
1515 meaning of the second and third component should be clear, and the hop
1516 method says what program to use to perform that hop.
1518 The first hop, @file{rsh@value{tramp-postfix-multi-hop}out@@gate},
1519 says to use @command{rsh} to log in as user @code{out} to the host
1520 @code{gate}.  Starting at that host, the second hop,
1521 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}, says to
1522 use @command{telnet} to log in as user @code{kai} to host
1523 @code{real.host}.
1525 @xref{Multi-hop Methods}, for a list of possible hop method values.
1526 The variable @code{tramp-multi-connection-function-alist} contains the
1527 list of possible hop methods and information on how to execute them,
1528 should you want to add your own.
1531 @node Filename completion
1532 @section Filename completion
1533 @cindex filename completion
1535 Filename completion works with @tramp{} for both completing methods,
1536 user names and machine names (except multi hop methods) as well as for
1537 files on remote machines.
1539 If you, for example, type @kbd{C-x C-f @value{tramp-prefix}t
1540 @key{TAB}}, @tramp{} might give you as result the choice for
1542 @example
1543 @ifset emacs
1544 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}                              tmp/
1545 @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1546 @end ifset
1547 @ifset xemacs
1548 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}                              @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1549 @end ifset
1550 @end example
1552 @samp{@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}}
1553 is a possible completion for the respective method,
1554 @ifset emacs
1555 @samp{tmp/} stands for the directory @file{/tmp} on your local
1556 machine,
1557 @end ifset
1558 and @samp{@value{tramp-prefix-single-hop}toto@value{tramp-postfix}}
1559 might be a host @tramp has detected in your @file{~/.ssh/known_hosts}
1560 file (given you're using default method @option{ssh}).
1562 If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
1563 @samp{@value{tramp-prefix}telnet@value{tramp-postfix-single-hop}}.
1564 Next @kbd{@key{TAB}} brings you all machine names @tramp{} detects in
1565 your @file{/etc/hosts} file, let's say
1567 @example
1568 @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}
1569 @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}
1570 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia@value{tramp-postfix}
1571 @end example
1573 Now you can choose the desired machine, and you can continue to
1574 complete file names on that machine.
1576 As filename completion needs to fetch the listing of files from the
1577 remote machine, this feature is sometimes fairly slow.  As @tramp{}
1578 does not yet cache the results of directory listing, there is no gain
1579 in performance the second time you complete filenames.
1581 If the configuration files (@pxref{Customizing Completion}), which
1582 @tramp{} uses for analysis of completion, offer user names, those user
1583 names will be taken into account as well.
1586 @node Dired
1587 @section Dired
1588 @cindex dired
1590 @tramp{} works transparently with dired, enabling you to use this powerful
1591 file management tool to manage files on any machine you have access to
1592 over the Internet.
1594 If you need to browse a directory tree, Dired is a better choice, at
1595 present, than filename completion.  Dired has its own cache mechanism
1596 and will only fetch the directory listing once.
1599 @node Bug Reports
1600 @chapter Reporting Bugs and Problems
1601 @cindex bug reports
1603 Bugs and problems with @tramp{} are actively worked on by the development
1604 team. Feature requests and suggestions are also more than welcome.
1606 The @tramp{} mailing list is a great place to get information on working
1607 with @tramp{}, solving problems and general discussion and advice on topics
1608 relating to the package.
1610 The  mailing list is at @email{tramp-devel@@mail.freesoftware.fsf.org}.
1611 Messages sent to this address go to all the subscribers. This is
1612 @emph{not} the address to send subscription requests to.
1614 For help on subscribing to the list, send mail to the administrative
1615 address, @email{tramp-devel-request@@mail.freesoftware.fsf.org}, with the
1616 subject @samp{help}.
1618 To report a bug in @tramp{}, you should execute @kbd{M-x tramp-bug}. This
1619 will automatically generate a buffer with the details of your system and
1620 @tramp{} version.
1622 When submitting a bug report, please try to describe in excruciating
1623 detail the steps required to reproduce the problem, the setup of the
1624 remote machine and any special conditions that exist.
1626 If you can identify a minimal test case that reproduces the problem,
1627 include that with your bug report. This will make it much easier for the
1628 development team to analyze and correct the problem.
1630 @node Frequently Asked Questions
1631 @chapter Frequently Asked Questions
1632 @cindex frequently asked questions
1633 @cindex FAQ
1635 @itemize @bullet
1636 @item
1637 Where can I get the latest @tramp{}?
1639 @tramp{} is available under the URL below.
1641 @noindent
1642 @uref{http://savannah.nongnu.org/download/tramp/}
1644 @noindent
1645 There is also a Savannah project page.
1647 @noindent
1648 @uref{https://savannah.gnu.org/projects/tramp/}
1650 @item
1651 Which systems does it work on?
1653 The package has been used successfully on Emacs 20 and Emacs 21, as well
1654 as XEmacs 21.  XEmacs 20 is more problematic, see the notes in
1655 @file{tramp.el}.  I don't think anybody has really tried it on Emacs 19.
1657 The package was intended to work on Unix, and it really expects a
1658 Unix-like system on the remote end, but some people seemed to have some
1659 success getting it to work on NT Emacs.
1661 There is some informations on @tramp{} on NT at the following URL;
1662 many thanks to Joe Stoy for providing the information:
1663 @uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}
1665 The above mostly contains patches to old ssh versions; Tom Roche has a
1666 Web page with instructions:
1667 @uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
1669 ??? Is the XEmacs info correct?
1671 ??? Can somebody provide some information for getting it to work on NT
1672 Emacs?  I think there was some issue with @command{ssh}?
1675 @item
1676 I can't stop @value{ftp-package-name} starting with @value{emacs-name}
1678 @ifset emacs
1679 @value{ftp-package-name} is loaded from @tramp{} automatically if you
1680 require a file by the ftp method.  Unfortunately, there are some Lisp
1681 packages which make @value{ftp-package-name} file name handlers active.
1682 You can see it applying @kbd{C-h v file-name-handler-alist}:
1684 @example
1685 file-name-handler-alist's value is 
1686 (("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
1687  ("^/[^/:]*[^/:.]:" . ange-ftp-hook-function)
1688  ("^/[^/]*$" . tramp-completion-file-name-handler)
1689  ("\\`/[^/:]+:" . tramp-file-name-handler)
1690  ("\\`/:" . file-name-non-special))
1691 @end example
1693 Please try to find out which package is responsible for loading
1694 @value{ftp-package-name}, and raise a bug report.
1696 A workaround is to require @value{ftp-package-name} before @tramp{} in
1697 your @file{~/.emacs}, because @tramp{} cleans up the entries in
1698 @code{file-name-handler-alist}:
1700 @lisp
1701 ;; @value{ftp-package-name} temporarily required
1702 (require 'ange-ftp)
1703 ;; @tramp{} cleans up @code{file-name-handler-alist}
1704 (require 'tramp)
1705 @end lisp
1706 @end ifset
1708 @ifset xemacs
1709 Not all the older versions of @tramp{} supported @value{emacs-name}
1710 correctly.  The first thing to do is to make sure that you have the
1711 latest version of @tramp{} installed.
1713 If you do, please try and find out exactly the conditions required for
1714 the @value{ftp-package-name} handlers to fire.  If you can, putting a
1715 breakpoint on @code{efs-ftp-path} and sending in the stack trace along
1716 with your bug report would make it easier for the developers to work out
1717 what is going wrong.
1718 @end ifset
1721 @item
1722 File name completion does not work with @tramp{}
1724 When you log in to the remote machine, do you see the output of
1725 @command{ls} in color? If so, this may be the cause of your problems.
1727 @command{ls} outputs @acronym{ANSI} escape sequences that your terminal
1728 emulator interprets to set the colors.  These escape sequences will
1729 confuse @tramp{} however.
1731 In your @file{.bashrc}, @file{.profile} or equivalent on the remote
1732 machine you probably have an alias configured that adds the option
1733 @option{--color=yes} or @option{--color=auto}.
1735 You should remove that alias and ensure that a new login @emph{does not}
1736 display the output of @command{ls} in color.  If you still cannot use
1737 filename completion, report a bug to the @tramp{} developers.
1740 @item
1741 File name completion does not work in large directories
1743 @tramp{} uses globbing for some operations.  (Globbing means to use the
1744 shell to expand wildcards such as `*.c'.)  This might create long
1745 command lines, especially in directories with many files.  Some shells
1746 choke on long command lines, or don't cope well with the globbing
1747 itself.
1749 If you have a large directory on the remote end, you may wish to execute
1750 a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
1751 Note that you must first start the right shell, which might be
1752 @command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
1753 of those supports tilde expansion.
1756 @item
1757 What kinds of systems does @tramp{} work on
1759 @tramp{} really expects the remote system to be a Unix-like system.  The
1760 local system should preferably be Unix-like, as well, but @tramp{} might
1761 work on NT with some tweaking.
1764 @item
1765 How can I get notified when @tramp{} file transfers are complete?
1767 The following snippet can be put in your @file{~/.emacs} file.  It makes
1768 Emacs beep after reading from or writing to the remote host.
1770 @lisp
1771 (defadvice tramp-handle-write-region
1772   (after tramp-write-beep-advice activate)
1773  " make tramp beep after writing a file."
1774  (interactive)
1775  (beep))
1776 (defadvice tramp-handle-do-copy-or-rename-file
1777   (after tramp-copy-beep-advice activate)
1778  " make tramp beep after copying a file."
1779  (interactive)
1780  (beep))
1781 (defadvice tramp-handle-insert-file-contents
1782   (after tramp-copy-beep-advice activate)
1783  " make tramp beep after copying a file."
1784  (interactive)
1785  (beep))
1786 @end lisp
1789 @item
1790 There's this @file{~/.sh_history} file on the remote host which keeps
1791 growing and growing.  What's that?
1793 Sometimes, @tramp{} starts @code{ksh} on the remote host for tilde
1794 expansion.  Maybe @code{ksh} saves the history by default.  @tramp{}
1795 tries to turn off saving the history, but maybe you have to help.  For
1796 example, you could put this in your @file{.kshrc}:
1798 @example
1799 if [ -f $HOME/.sh_history ] ; then
1800    /bin/rm $HOME/.sh_history
1802 if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
1803    unset HISTFILE
1805 if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
1806    unset HISTSIZE
1808 @end example
1811 @item @tramp{} doesn't transfer strings with more than 500 characters
1812 correctly
1814 On some few systems, the implementation of @code{process-send-string}
1815 seems to be broken for longer strings.  This case, you should
1816 customize the variable @code{tramp-chunksize} to 500.  For a
1817 description how to determine whether this is necessary see the
1818 documentation of @code{tramp-chunksize}.
1820 @end itemize
1823 @c For the developer
1824 @node Version Control
1825 @chapter The inner workings of remote version control
1827 Unlike @value{ftp-package-name}, @tramp{} has full shell access to the
1828 remote machine. This makes it possible to provide version control for
1829 files accessed under @tramp{}.
1831 The actual version control binaries must be installed on the remote
1832 machine, accessible in the directories specified in
1833 @var{tramp-remote-path}.
1835 This transparent integration with the version control systems is one of
1836 the most valuable features provided by @tramp{}, but it is far from perfect.
1837 Work is ongoing to improve the transparency of the system.
1839 @menu
1840 * Version Controlled Files::    Determining if a file is under version control.
1841 * Remote Commands::             Executing the version control commands on the remote machine.
1842 * Changed workfiles::           Detecting if the working file has changed.
1843 * Checking out files::          Bringing the workfile out of the repository.
1844 * Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
1845 @end menu
1848 @node Version Controlled Files
1849 @section Determining if a file is under version control
1851 The VC package uses the existence of on-disk revision control master
1852 files to determine if a given file is under revision control. These file
1853 tests happen on the remote machine through the standard @tramp{} mechanisms.
1856 @node Remote Commands
1857 @section Executing the version control commands on the remote machine
1859 There are no hooks provided by VC to allow intercepting of the version
1860 control command execution. The calls occur through the
1861 @code{call-process} mechanism, a function that is somewhat more
1862 efficient than the @code{shell-command} function but that does not
1863 provide hooks for remote execution of commands.
1865 To work around this, the functions @code{vc-do-command} and
1866 @code{vc-simple-command} have been advised to intercept requests for
1867 operations on files accessed via @tramp{}.
1869 In the case of a remote file, the @code{shell-command} interface is
1870 used, with some wrapper code, to provide the same functionality on the
1871 remote machine as would be seen on the local machine. 
1874 @node Changed workfiles
1875 @section Detecting if the working file has changed
1877 As there is currently no way to get access to the mtime of a file on a
1878 remote machine in a portable way, the @code{vc-workfile-unchanged-p}
1879 function is advised to call an @tramp{} specific function for remote files.
1881 The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
1882 diff functionality to determine if any changes have occurred between the
1883 workfile and the version control master.
1885 This requires that a shell command be executed remotely, a process that
1886 is notably heavier-weight than the mtime comparison used for local
1887 files. Unfortunately, unless a portable solution to the issue is found,
1888 this will remain the cost of remote version control.
1891 @node Checking out files
1892 @section Bringing the workfile out of the repository
1894 VC will, by default, check for remote files and refuse to act on them
1895 when checking out files from the repository. To work around this
1896 problem, the function @code{vc-checkout} knows about @tramp{} files and
1897 allows version control to occur.
1900 @node Miscellaneous Version Control
1901 @section Things related to Version Control that don't fit elsewhere
1903 Minor implementation details, &c.
1905 @menu
1906 * Remote File Ownership::       How VC determines who owns a workfile.
1907 * Back-end Versions::           How VC determines what release your RCS is.
1908 @end menu
1911 @node Remote File Ownership
1912 @subsection How VC determines who owns a workfile
1914 Emacs provides the @code{user-full-name} function to return the login name
1915 of the current user as well as mapping from arbitrary user id values
1916 back to login names. The VC code uses this functionality to map from the
1917 uid of the owner of a workfile to the login name in some circumstances.
1919 This will not, for obvious reasons, work if the remote system has a
1920 different set of logins. As such, it is necessary to delegate to the
1921 remote machine the job of determining the login name associated with a
1922 uid.
1924 Unfortunately, with the profusion of distributed management systems such
1925 as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
1926 reliable and portable method for performing this mapping.
1928 Thankfully, the only place in the VC code that depends on the mapping of
1929 a uid to a login name is the @code{vc-file-owner} function. This returns
1930 the login of the owner of the file as a string.
1932 This function has been advised to use the output of @command{ls} on the
1933 remote machine to determine the login name, delegating the problem of
1934 mapping the uid to the login to the remote system which should know more
1935 about it than I do.
1938 @node Back-end Versions
1939 @subsection How VC determines what release your RCS is
1941 VC needs to know what release your revision control binaries you are
1942 running as not all features VC supports are available with older
1943 versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.
1945 The default implementation of VC determines this value the first time it
1946 is needed and then stores the value globally to avoid the overhead of
1947 executing a process and parsing its output each time the information is
1948 needed.
1950 Unfortunately, life is not quite so easy when remote version control
1951 comes into the picture. Each remote machine may have a different version
1952 of the version control tools and, while this is painful, we need to
1953 ensure that unavailable features are not used remotely.
1955 To resolve this issue, @tramp{} currently takes the sledgehammer
1956 approach of making the release values of the revision control tools
1957 local to each @tramp{} buffer, forcing VC to determine these values
1958 again each time a new file is visited.
1960 This has, quite obviously, some performance implications. Thankfully,
1961 most of the common operations performed by VC do not actually require
1962 that the remote version be known. This makes the problem far less
1963 apparent.
1965 Eventually these values will be captured by @tramp{} on a system by
1966 system basis and the results cached to improve performance.
1969 @node Files directories and localnames
1970 @chapter How file names, directories and localnames are mangled and managed.
1972 @menu
1973 * Localname deconstruction::    Breaking a localname into its components.
1974 @end menu
1977 @node Localname deconstruction
1978 @section Breaking a localname into its components.
1980 @tramp{} file names are somewhat different, obviously, to ordinary file
1981 names. As such, the lisp functions @code{file-name-directory} and
1982 @code{file-name-nondirectory} are overridden within the @tramp{}
1983 package.
1985 Their replacements are reasonably simplistic in their approach. They
1986 dissect the filename, call the original handler on the localname and
1987 then rebuild the @tramp{} file name with the result.
1989 This allows the platform specific hacks in the original handlers to take
1990 effect while preserving the @tramp{} file name information.
1993 @node Issues
1994 @chapter Debatable Issues and What Was Decided
1996 @itemize @bullet
1997 @item The uuencode method does not always work.
1999 Due to the design of @tramp{}, the encoding and decoding programs need to
2000 read from stdin and write to stdout.  On some systems, @code{uudecode -o
2001 -} will read stdin and write the decoded file to stdout, on other
2002 systems @code{uudecode -p} does the same thing.  But some systems have
2003 uudecode implementations which cannot do this at all---it is not
2004 possible to call these uudecode implementations with suitable parameters
2005 so that they write to stdout.
2007 Of course, this could be circumvented: the @code{begin foo 644} line
2008 could be rewritten to put in some temporary file name, then
2009 @code{uudecode} could be called, then the temp file could be printed and
2010 deleted.
2012 But I have decided that this is too fragile to reliably work, so on some
2013 systems you'll have to do without the uuencode methods.
2015 @item @tramp{} does not work on XEmacs 20.
2017 This is because it requires the macro @code{with-timeout} which does not
2018 appear to exist in XEmacs 20.  I'm somewhat reluctant to add an
2019 emulation macro to @tramp{}, but if somebody who uses XEmacs 20 steps
2020 forward and wishes to implement and test it, please contact me or the
2021 mailing list.
2023 @item The @tramp{} filename syntax differs between Emacs and XEmacs.
2025 The Emacs maintainers wish to use a unified filename syntax for
2026 Ange-FTP and @tramp{} so that users don't have to learn a new
2027 syntax.  It is sufficient to learn some extensions to the old syntax.
2029 For the XEmacs maintainers, the problems caused from using a unified
2030 filename syntax are greater than the gains.  The XEmacs package system
2031 uses EFS for downloading new packages.  So, obviously, EFS has to be
2032 installed from the start.  If the filenames were unified, @tramp{}
2033 would have to be installed from the start, too.
2035 @end itemize
2038 @c End of tramp.texi - the TRAMP User Manual
2039 @bye
2041 @c TODO
2043 @c * Say something about the .login and .profile files of the remote
2044 @c   shells.
2045 @c * Explain how tramp.el works in principle: open a shell on a remote
2046 @c   host and then send commands to it.
2047 @c * Mention that bookmarks are a cool feature to go along with Tramp.
2048 @c * Make terminology "inline" vs "out-of-band" consistent.
2049 @c   It seems that "external" is also used instead of "out-of-band".
2051 @c * M. Albinus
2052 @c ** Use `filename' resp. `file name' consistently.
2053 @c ** Use `host' resp. `machine' consistently.
2054 @c ** Consistent small or capitalized words especially in menues.