1 \input texinfo @c -*-texinfo-*-
3 @setfilename ../info/tramp
4 @settitle TRAMP User Manual
8 @c This is *so* much nicer :)
11 @c In the Tramp CVS, the version number is auto-frobbed from
12 @c configure.ac, so you should edit that file and run
13 @c "autoconf && ./configure" to change the version number.
15 @c Additionally, flags are set with respect to the Emacs flavor; and
16 @c depending whether Tramp is packaged into (X)Emacs, or standalone.
18 @include trampver.texi
20 @c Macro to make formatting of the tramp program name consistent.
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}
33 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004 Free Software
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.
56 @c Entries for @command{install-info} to use
57 @dircategory @value{emacs-name}
59 * TRAMP: (tramp). Transparent Remote Access, Multiple Protocol
60 @value{emacs-name} remote file access via rsh and rcp.
66 @title @tramp{} version @trampver{} User Manual
68 @author by Daniel Pittman
69 @author based on documentation by Kai Gro@ss{}johann
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.
106 This manual is also available as a @uref{@value{japanese-manual},
107 Japanese translation}.
110 The latest release of @tramp{} is available for
111 @uref{http://savannah.nongnu.org/download/tramp/,
112 download}, or you may see @ref{Obtaining @tramp{}} for more details,
113 including the CVS server details.
115 @tramp{} also has a @uref{http://savannah.nongnu.org/projects/tramp/,
116 Savannah Project Page}.
119 There is a mailing list for @tramp{}, available at
120 @email{tramp-devel@@mail.freesoftware.fsf.org}, and archived at
121 @uref{http://savannah.nongnu.org/mail/?group=tramp, Savannah Mail
124 Older archives are located at
125 @uref{http://sourceforge.net/mailarchive/forum.php?forum=tramp-devel,
126 SourceForge Mail Archive} and
127 @uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/,
129 @c in HTML output, there's no new paragraph.
138 * Overview:: What @tramp{} can and cannot do.
142 * Obtaining @tramp{}:: How to obtain @tramp{}.
143 * History:: History of @tramp{}.
145 * Installation:: Installing @tramp{} with your @value{emacs-name}.
147 * Configuration:: Configuring @tramp{} for use.
148 * Usage:: An overview of the operation of @tramp{}.
149 * Bug Reports:: Reporting Bugs and Problems.
150 * Frequently Asked Questions:: Questions and answers from the mailing list.
151 * Concept Index:: An item for each concept.
155 * Version Control:: The inner workings of remote version control.
156 * Files directories and localnames:: How file names, directories and localnames are mangled and managed.
157 * Issues:: Debatable Issues and What Was Decided.
160 --- The Detailed Node Listing ---
163 Installing @tramp{} with your @value{emacs-name}
165 * Installation parameters:: Parameters in order to control installation.
166 * Load paths:: How to plug-in @tramp{} into your environment.
167 * Japanese manual:: Japanese manual.
171 Configuring @tramp{} for use
173 * Connection types:: Types of connections made to remote machines.
174 * Inline methods:: Inline methods.
175 * External transfer methods:: External transfer methods.
176 * Multi-hop Methods:: Connecting to a remote host using multiple hops.
177 * Default Method:: Selecting a default method.
178 * Customizing Methods:: Using Non-Standard Methods.
179 * Customizing Completion:: Selecting config files for user/host name completion.
180 * Password caching:: Reusing passwords for several connections.
181 * Remote Programs:: How @tramp{} finds and uses programs on the remote machine.
182 * Remote shell setup:: Remote shell setup hints.
183 * Windows setup hints:: Issues with Cygwin ssh.
184 * Auto-save and Backup:: Auto-save and Backup.
188 * Filename Syntax:: @tramp{} filename conventions.
189 * Multi-hop filename syntax:: Multi-hop filename conventions.
190 * Filename completion:: Filename completion.
193 The inner workings of remote version control
195 * Version Controlled Files:: Determining if a file is under version control.
196 * Remote Commands:: Executing the version control commands on the remote machine.
197 * Changed workfiles:: Detecting if the working file has changed.
198 * Checking out files:: Bringing the workfile out of the repository.
199 * Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
201 Things related to Version Control that don't fit elsewhere
203 * Remote File Ownership:: How VC determines who owns a workfile.
204 * Back-end Versions:: How VC determines what release your RCS is.
206 How file names, directories and localnames are mangled and managed
208 * Localname deconstruction:: Breaking a localname into its components.
214 @chapter An overview of @tramp{}
217 After the installation of @tramp{} into your @value{emacs-name}, you
218 will be able to access files on remote machines as though they were
219 local. Access to the remote file system for editing files, version
220 control, and @command{dired} are transparently enabled.
222 Your access to the remote machine can be with the @command{rsh},
223 @command{rlogin}, @command{telnet} programs or with any similar
224 connection method. This connection must pass @acronym{ASCII}
225 successfully to be usable but need not be 8-bit clean.
227 The package provides support for @command{ssh} connections out of the
228 box, one of the more common uses of the package. This allows
229 relatively secure access to machines, especially if @command{ftp}
232 The majority of activity carried out by @tramp{} requires only that
233 the remote login is possible and is carried out at the terminal. In
234 order to access remote files @tramp{} needs to transfer their content
235 to the local machine temporarily.
237 @tramp{} can transfer files between the machines in a variety of ways.
238 The details are easy to select, depending on your needs and the
239 machines in question.
241 The fastest transfer methods (for large files) rely on a remote file
242 transfer package such as @command{rcp}, @command{scp} or
243 @command{rsync}. The use of these methods is only possible if the
244 file copy command does not ask for a password for the remote machine.
246 If the remote copy methods are not suitable for you, @tramp{} also
247 supports the use of encoded transfers directly through the shell.
248 This requires that the @command{mimencode} or @command{uuencode} tools
249 are available on the remote machine. These methods are generally
250 faster for small files.
252 Within these limitations, @tramp{} is quite powerful. It is worth
253 noting that, as of the time of writing, it is far from a polished
254 end-user product. For a while yet you should expect to run into rough
255 edges and problems with the code now and then.
257 It is finished enough that the developers use it for day to day work but
258 the installation and setup can be a little difficult to master, as can
261 @tramp{} is still under active development and any problems you encounter,
262 trivial or major, should be reported to the @tramp{} developers.
266 @subsubheading Behind the scenes
267 @cindex behind the scenes
268 @cindex details of operation
271 This section tries to explain what goes on behind the scenes when you
272 access a remote file through @tramp{}.
274 Suppose you type @kbd{C-x C-f} and enter part of an @tramp{} file name,
275 then hit @kbd{@key{TAB}} for completion. Suppose further that this is
276 the first time that @tramp{} is invoked for the host in question. Here's
281 @tramp{} discovers that it needs a connection to the host. So it
282 invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
283 @var{user}} or a similar tool to connect to the remote host.
284 Communication with this process happens through an
285 @value{emacs-name} buffer, that is, the output from the remote end
289 The remote host may prompt for a login name (for @command{telnet}). The
290 login name is given in the file name, so @tramp{} sends the login name and
294 The remote host may prompt for a password or pass phrase (for
295 @command{rsh} or for @command{telnet} after sending the login name).
296 @tramp{} displays the prompt in the minibuffer, asking you for the
297 password or pass phrase.
299 You enter the password or pass phrase. @tramp{} sends it to the remote
300 host, followed by a newline.
303 @tramp{} now waits for the shell prompt or for a message that the login
306 If @tramp{} sees neither of them after a certain period of time (a minute,
307 say), then it issues an error message saying that it couldn't find the
308 remote shell prompt and shows you what the remote host has sent.
310 If @tramp{} sees a @samp{login failed} message, it tells you so,
311 aborts the login attempt and allows you to try again.
314 Suppose that the login was successful and @tramp{} sees the shell prompt
315 from the remote host. Now @tramp{} invokes @command{/bin/sh} because
316 Bourne shells and C shells have different command
317 syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
318 shell doesn't recognize @samp{exec /bin/sh} as a valid command.
319 Maybe you use the Scheme shell @command{scsh}@dots{}}
321 After the Bourne shell has come up, @tramp{} sends a few commands to
322 ensure a good working environment. It turns off echoing, it sets the
323 shell prompt, and a few other things.
326 Now the remote shell is up and it good working order. Remember, what
327 was supposed to happen is that @tramp{} tries to find out what files exist
328 on the remote host so that it can do filename completion.
330 So, @tramp{} basically issues @command{cd} and @command{ls} commands and
331 also sometimes @command{echo} with globbing. Another command that is
332 often used is @command{test} to find out whether a file is writable or a
333 directory or the like. The output of each command is parsed for the
337 Suppose you are finished with filename completion, have entered @kbd{C-x
338 C-f}, a full file name and hit @kbd{@key{RET}}. Now comes the time to
339 transfer the file contents from the remote host to the local host so
340 that you can edit them.
342 See above for an explanation of how @tramp{} transfers the file contents.
344 For inline transfers, @tramp{} issues a command like @samp{mimencode -b
345 /path/to/remote/file}, waits until the output has accumulated in the
346 buffer that's used for communication, then decodes that output to
347 produce the file contents.
349 For out-of-band transfers, @tramp{} issues a command like the following:
351 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
353 It then reads the local temporary file @file{/tmp/tramp.4711} into a
354 buffer and deletes the temporary file.
357 You now edit the buffer contents, blithely unaware of what has happened
358 behind the scenes. (Unless you have read this section, that is.) When
359 you are finished, you type @kbd{C-x C-s} to save the buffer.
362 Again, @tramp{} transfers the file contents to the remote host either
363 inline or out-of-band. This is the reverse of what happens when reading
368 I hope this has provided you with a basic overview of what happens
369 behind the scenes when you open a file with @tramp{}.
373 @node Obtaining @tramp{}
374 @chapter Obtaining @tramp{}.
375 @cindex obtaining @tramp{}
377 @tramp{} is freely available on the Internet and the latest release
378 may be downloaded from
379 @uref{http://savannah.nongnu.org/download/tramp/}. This
380 release includes the full documentation and code for @tramp{},
381 suitable for installation. But Emacs (21.4 or later) includes
382 @tramp{} already, and there is a @tramp{} package for XEmacs, as well.
383 So maybe it is easier to just use those. But if you want the bleeding
384 edge, read on@dots{...}
386 For the especially brave, @tramp{} is available from CVS. The CVS
387 version is the latest version of the code and may contain incomplete
388 features or new issues. Use these versions at your own risk.
390 Instructions for obtaining the latest development version of @tramp{}
391 from CVS can be found by going to the Savannah project page at the
392 following URL and then clicking on the CVS link in the navigation bar
396 @uref{http://savannah.nongnu.org/projects/tramp/}
399 Or follow the example session below:
402 ] @strong{cd ~/@value{emacs-dir}}
403 ] @strong{export CVS_RSH="ssh"}
404 ] @strong{cvs -z3 -d:ext:anoncvs@@savannah.nongnu.org:/cvsroot/tramp co tramp}
408 You should now have a directory @file{~/@value{emacs-dir}/tramp}
409 containing the latest version of @tramp{}. You can fetch the latest
410 updates from the repository by issuing the command:
413 ] @strong{cd ~/@value{emacs-dir}/tramp}
414 ] @strong{export CVS_RSH="ssh"}
415 ] @strong{cvs update -d}
419 Once you've got updated files from the CVS repository, you need to run
420 @command{autoconf} in order to get an up-to-date @file{configure}
424 ] @strong{cd ~/@value{emacs-dir}/tramp}
430 @chapter History of @tramp{}
432 @cindex development history
434 Development was started end of November 1998. The package was called
435 @file{rssh.el}, back then. It only provided one method to access a
436 file, using @command{ssh} to log in to a remote host and using
437 @command{scp} to transfer the file contents. After a while, the name
438 was changed to @file{rcp.el}, and now it's @tramp{}. Along the way,
439 many more methods for getting a remote shell and for transferring the
440 file contents were added. Support for VC was added.
442 The most recent addition of major features were the multi-hop methods
443 added in April 2000 and the unification of @tramp{} and Ange-FTP
444 filenames in July 2002.
446 @c Installation chapter is necessary only in case of standalone
447 @c installation. Text taken from trampinst.texi.
449 @installationchapter{}
453 @chapter Configuring @tramp{} for use
454 @cindex configuration
456 @cindex default configuration
457 @tramp{} is (normally) fully functional when it is initially installed.
458 It is initially configured to use the @command{ssh} program to connect
459 to the remote host and to use base64 or uu encoding to transfer the
460 files through that shell connection. So in the easiest case, you just
461 type @kbd{C-x C-f} and then enter the filename
462 @file{@value{tramp-prefix}@var{user}@@@var{machine}@value{tramp-postfix}@var{/path/to.file}}.
464 On some hosts, there are problems with opening a connection. These are
465 related to the behavior of the remote shell. See @xref{Remote shell
466 setup}, for details on this.
468 If you do not wish to use these commands to connect to the remote
469 host, you should change the default connection and transfer method
470 that @tramp{} uses. There are several different methods that @tramp{}
471 can use to connect to remote machines and transfer files
472 (@pxref{Connection types}).
474 If you don't know which method is right for you, see @xref{Default
479 * Connection types:: Types of connections made to remote machines.
480 * Inline methods:: Inline methods.
481 * External transfer methods:: External transfer methods.
482 * Multi-hop Methods:: Connecting to a remote host using multiple hops.
483 * Default Method:: Selecting a default method.
484 Here we also try to help those who
485 don't have the foggiest which method
487 * Customizing Methods:: Using Non-Standard Methods.
488 * Customizing Completion:: Selecting config files for user/host name completion.
489 * Password caching:: Reusing passwords for several connections.
490 * Remote Programs:: How @tramp{} finds and uses programs on the remote machine.
491 * Remote shell setup:: Remote shell setup hints.
492 * Windows setup hints:: Issues with Cygwin ssh.
493 * Auto-save and Backup:: Auto-save and Backup.
497 @node Connection types
498 @section Types of connections made to remote machines.
499 @cindex connection types, overview
501 There are two basic types of transfer methods, each with its own
502 advantages and limitations. Both types of connection make use of a
503 remote shell access program such as @command{rsh}, @command{ssh} or
504 @command{telnet} to connect to the remote machine.
506 This connection is used to perform many of the operations that @tramp{}
507 requires to make the remote file system transparently accessible from
508 the local machine. It is only when visiting files that the methods
511 @cindex inline methods
512 @cindex external transfer methods
513 @cindex external methods
514 @cindex out-of-band methods
515 @cindex methods, inline
516 @cindex methods, external transfer
517 @cindex methods, out-of-band
518 Loading or saving a remote file requires that the content of the file
519 be transfered between the two machines. The content of the file can be
520 transfered over the same connection used to log in to the remote
521 machine or the file can be transfered through another connection using
522 a remote copy program such as @command{rcp}, @command{scp} or
523 @command{rsync}. The former are called @dfn{inline methods}, the
524 latter are called @dfn{out-of-band methods} or @dfn{external transfer
525 methods} (@dfn{external methods} for short).
527 The performance of the external transfer methods is generally better
528 than that of the inline methods, at least for large files. This is
529 caused by the need to encode and decode the data when transferring
532 The one exception to this rule are the @command{scp} based transfer
533 methods. While these methods do see better performance when actually
534 transferring files, the overhead of the cryptographic negotiation at
535 startup may drown out the improvement in file transfer times.
537 External transfer methods do require that the remote copy command is not
538 interactive --- that is, the command does not prompt you for a password.
539 If you cannot perform remote copies without a password, you will need to
540 use an inline transfer method to work with @tramp{}.
542 @cindex multi-hop methods
543 @cindex methods, multi-hop
544 A variant of the inline methods are the @dfn{multi-hop methods}.
545 These methods allow you to connect a remote host using a number `hops',
546 each of which connects to a different host. This is useful if you are
547 in a secured network where you need to go through a bastion host to
548 connect to the outside world.
552 @section Inline methods
553 @cindex inline methods
554 @cindex methods, inline
556 The inline methods in @tramp{} are quite powerful and can work in
557 situations where you cannot use an external transfer program to connect.
558 Inline methods are the only methods that work when connecting to the
559 remote machine via telnet. (There are also strange inline methods which
560 allow you to transfer files between @emph{user identities} rather than
563 These methods depend on the existence of a suitable encoding and
564 decoding command on remote machine. Locally, @tramp{} may be able to
565 use features of @value{emacs-name} to decode and encode the files or
566 it may require access to external commands to perform that task.
570 @cindex base-64 encoding
571 @tramp{} checks the availability and usability of commands like
572 @command{mimencode} (part of the @command{metamail} package) or
573 @command{uuencode} on the remote host. The first reliable command
574 will be used. The search path can be customized, see @ref{Remote
577 If both commands aren't available on the remote host, @tramp{}
578 transfers a small piece of Perl code to the remote host, and tries to
579 apply it for encoding and decoding.
587 Connect to the remote host with @command{rsh}. Due to the unsecure
588 connection it is recommended for very local host topology only.
590 On operating systems which provide the command @command{remsh} instead
591 of @command{rsh}, you can use the method @option{remsh}. This is true
592 for HP-UX or Cray UNICOS, for example.
599 Connect to the remote host with @command{ssh}. This is identical to
600 the previous option except that the @command{ssh} package is used,
601 making the connection more secure.
603 There are also two variants, @option{ssh1} and @option{ssh2}, that
604 call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
605 explicitly select whether you want to use the SSH protocol version 1
606 or 2 to connect to the remote host. (You can also specify in
607 @file{~/.ssh/config}, the SSH configuration file, which protocol
608 should be used, and use the regular @option{ssh} method.)
610 Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
611 @command{ssh1} and @command{ssh2} commands explicitly. If you don't
612 know what these are, you do not need these options.
614 All the methods based on @command{ssh} have an additional kludgy
615 feature: you can specify a host name which looks like @file{host#42}
616 (the real host name, then a hash sign, then a port number). This
617 means to connect to the given host but to also pass @code{-p 42} as
618 arguments to the @command{ssh} command.
621 @item @option{telnet}
622 @cindex method telnet
623 @cindex telnet method
625 Connect to the remote host with @command{telnet}. This is as unsecure
626 as the @option{rsh} method.
633 This method does not connect to a remote host at all, rather it uses
634 the @command{su} program to allow you to edit files as another user.
641 This is similar to the @option{su} method, but it uses @command{sudo}
642 rather than @command{su} to become a different user.
644 Note that @command{sudo} must be configured to allow you to start a
645 shell as the user. It would be nice if it was sufficient if
646 @command{ls} and @command{mimencode} were allowed, but that is not
647 easy to implement, so I haven't got around to it, yet.
653 @cindex Cygwin (with sshx method)
655 As you would expect, this is similar to @option{ssh}, only a little
656 different. Whereas @option{ssh} opens a normal interactive shell on
657 the remote host, this option uses @samp{ssh -t -t @var{host} -l
658 @var{user} /bin/sh} to open a connection. This is useful for users
659 where the normal login shell is set up to ask them a number of
660 questions when logging in. This procedure avoids these questions, and
661 just gives @tramp{} a more-or-less `standard' login shell to work
664 Note that this procedure does not eliminate questions asked by
665 @command{ssh} itself. For example, @command{ssh} might ask ``Are you
666 sure you want to continue connecting?'' if the host key of the remote
667 host is not known. @tramp{} does not know how to deal with such a
668 question (yet), therefore you will need to make sure that you can log
669 in without such questions.
671 This is also useful for Windows users where @command{ssh}, when
672 invoked from an @value{emacs-name} buffer, tells them that it is not
673 allocating a pseudo tty. When this happens, the login shell is wont
674 to not print any shell prompt, which confuses @tramp{} mightily. For
675 reasons unknown, some Windows ports for @command{ssh} (maybe the
676 Cygwin one) require the doubled @samp{-t} option.
678 This supports the @samp{-p} kludge.
681 @item @option{krlogin}
682 @cindex method krlogin
684 @cindex Kerberos (with krlogin method)
686 This method is also similar to @option{ssh}. It only uses the
687 @command{krlogin -x} command to log in to the remote host.
694 This method is mostly interesting for Windows users using the PuTTY
695 implementation of SSH. It uses @samp{plink -ssh} to log in to the
698 Additionally, the method @option{plink1} is provided, which calls
699 @samp{plink -1 -ssh} in order to use SSH protocol version 1
702 CCC: Do we have to connect to the remote host once from the command
703 line to accept the SSH key? Maybe this can be made automatic?
705 CCC: Does @command{plink} support the @samp{-p} option? @tramp{} will
706 support that, anyway.
712 @node External transfer methods
713 @section External transfer methods
714 @cindex methods, external transfer
715 @cindex methods, out-of-band
716 @cindex external transfer methods
717 @cindex out-of-band methods
719 The external transfer methods operate through multiple channels, using
720 the remote shell connection for many actions while delegating file
721 transfers to an external transfer utility.
723 This saves the overhead of encoding and decoding that multiplexing the
724 transfer through the one connection has with the inline methods.
726 If you want to use an external transfer method you @emph{must} be able
727 to execute the transfer utility to copy files to and from the remote
728 machine without any interaction.
731 This means that you will need to use @command{ssh-agent} if you use the
732 @command{scp} program for transfers, or maybe your version of
733 @command{scp} accepts a password on the command line.@footnote{PuTTY's
734 @command{pscp} allows you to specify the password on the command line.}
735 If you use @command{rsync} via @command{ssh} then the same rule must
736 apply to that connection.
738 If you cannot get @command{scp} to run without asking for a password but
739 would still like to use @command{ssh} to secure your connection, have a
740 look at the @command{ssh} based inline methods.
744 @item @option{rcp} --- @command{rsh} and @command{rcp}
747 @cindex rcp (with rcp method)
748 @cindex rsh (with rcp method)
750 This method uses the @command{rsh} and @command{rcp} commands to connect
751 to the remote machine and transfer files. This is probably the fastest
752 connection method available.
754 The alternative method @option{remcp} uses the @command{remsh} and
755 @command{rcp} commands. It should be applied on machines where
756 @command{remsh} is used instead of @command{rsh}.
759 @item @option{scp} --- @command{ssh} and @command{scp}
762 @cindex scp (with scp method)
763 @cindex ssh (with scp method)
765 Using @command{ssh} to connect to the remote host and @command{scp} to
766 transfer files between the machines is the best method for securely
767 connecting to a remote machine and accessing files.
769 The performance of this option is also quite good. It may be slower than
770 the inline methods when you often open and close small files however.
771 The cost of the cryptographic handshake at the start of an @command{scp}
772 session can begin to absorb the advantage that the lack of encoding and
775 There are also two variants, @option{scp1} and @option{scp2}, that
776 call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
777 explicitly select whether you want to use the SSH protocol version 1
778 or 2 to connect to the remote host. (You can also specify in
779 @file{~/.ssh/config}, the SSH configuration file, which protocol
780 should be used, and use the regular @option{scp} method.)
782 Two other variants, @option{scp1_old} and @option{scp2_old}, use the
783 @command{ssh1} and @command{ssh2} commands explicitly. If you don't
784 know what these are, you do not need these options.
786 All the @command{ssh} based methods support the kludgy @samp{-p}
787 feature where you can specify a port number to connect to in the host
788 name. For example, the host name @file{host#42} tells @tramp{} to
789 specify @samp{-p 42} in the argument list for @command{ssh}.
792 @item @option{rsync} --- @command{ssh} and @command{rsync}
795 @cindex rsync (with rsync method)
796 @cindex ssh (with rsync method)
798 Using the @command{ssh} command to connect securely to the remote
799 machine and the @command{rsync} command to transfer files is almost
800 identical to the @option{scp} method.
802 While @command{rsync} performs much better than @command{scp} when
803 transferring files that exist on both hosts, this advantage is lost if
804 the file exists only on one side of the connection.
806 The @command{rsync} based method may be considerably faster than the
807 @command{rcp} based methods when writing to the remote system. Reading
808 files to the local machine is no faster than with a direct copy.
810 This method supports the @samp{-p} hack.
813 @item @option{scpx} --- @command{ssh} and @command{scp}
816 @cindex scp (with scpx method)
817 @cindex ssh (with scpx method)
818 @cindex Cygwin (with scpx method)
820 As you would expect, this is similar to @option{scp}, only a little
821 different. Whereas @option{scp} opens a normal interactive shell on
822 the remote host, this option uses @samp{ssh -t -t @var{host} -l
823 @var{user} /bin/sh} to open a connection. This is useful for users
824 where the normal login shell is set up to ask them a number of
825 questions when logging in. This procedure avoids these questions, and
826 just gives @tramp{} a more-or-less `standard' login shell to work
829 This is also useful for Windows users where @command{ssh}, when
830 invoked from an @value{emacs-name} buffer, tells them that it is not
831 allocating a pseudo tty. When this happens, the login shell is wont
832 to not print any shell prompt, which confuses @tramp{} mightily.
833 Maybe this applies to the Cygwin port of SSH.
835 This method supports the @samp{-p} hack.
838 @item @option{pscp} --- @command{plink} and @command{pscp}
841 @cindex pscp (with pscp method)
842 @cindex plink (with pscp method)
843 @cindex PuTTY (with pscp method)
845 This method is similar to @option{scp}, but it uses the
846 @command{plink} command to connect to the remote host, and it uses
847 @command{pscp} for transferring the files. These programs are part
848 of PuTTY, an SSH implementation for Windows.
850 CCC: Does @command{plink} support the @samp{-p} hack?
853 @item @option{fcp} --- @command{fsh} and @command{fcp}
856 @cindex fsh (with fcp method)
857 @cindex fcp (with fcp method)
859 This method is similar to @option{scp}, but it uses the @command{fsh}
860 command to connect to the remote host, and it uses @command{fcp} for
861 transferring the files. @command{fsh/fcp} are a front-end for
862 @command{ssh} which allow for reusing the same @command{ssh} session
863 for submitting several commands. This avoids the startup overhead of
864 @command{scp} (which has to establish a secure connection whenever it
865 is called). Note, however, that you can also use one of the inline
866 methods to achieve a similar effect.
868 This method uses the command @samp{fsh @var{host} -l @var{user}
869 /bin/sh -i} to establish the connection, it does not work to just say
870 @command{fsh @var{host} -l @var{user}}.
875 There is no inline method using @command{fsh} as the multiplexing
876 provided by the program is not very useful in our context. @tramp{}
877 opens just one connection to the remote host and then keeps it open,
885 This is not a native @tramp{} method. Instead of, it forwards all
886 requests to @value{ftp-package-name}.
888 This works only for unified filenames, see @ref{Issues}.
892 @item @option{smb} --- @command{smbclient}
896 This is another not natural @tramp{} method. It uses the
897 @command{smbclient} command on different Unices in order to connect to
898 an SMB server. An SMB server might be a Samba (or CIFS) server on
899 another UNIX host or, more interesting, a host running MS Windows. So
900 far, it is tested towards MS Windows NT, MS Windows 2000, and MS
903 The first directory in the localname must be a share name on the remote
904 host. Remember, that the @code{$} character in which default shares
905 usually end, must be written @code{$$} due to environment variable
906 substitution in file names. If no share name is given (i.e. remote
907 directory @code{/}), all available shares are listed.
909 Since authorization is done on share level, you will be prompted
910 always for a password if you access another share on the same host.
911 This can be suppressed by @ref{Password caching}.
913 MS Windows uses for authorization both a user name and a domain name.
914 Because of this, the @tramp{} syntax has been extended: you can
915 specify a user name which looks like @code{user%domain} (the real user
916 name, then a percent sign, then the domain name). So, to connect to
917 the machine @code{melancholia} as user @code{daniel} of the domain
918 @code{BIZARRE}, and edit @file{.emacs} in the home directory (share
919 @code{daniel$}) I would specify the filename
920 @file{@value{tramp-prefix}smb@value{tramp-postfix-single-hop}daniel%BIZARRE@@melancholia@value{tramp-postfix}/daniel$$/.emacs}.
922 The domain name as well as the user name are optional. If no user
923 name is specified at all, the anonymous user (without password
924 prompting) is assumed. This is different from all other @tramp{}
925 methods, where in such a case the local user name is taken.
927 The @option{smb} method supports the @samp{-p} hack.
929 @strong{Please note:} If @value{emacs-name} runs locally under MS
930 Windows, this method isn't available. Instead of, you can use UNC
931 file names like @file{//melancholia/daniel$$/.emacs}. The only
932 disadvantage is that there's no possibility to specify another user
937 @node Multi-hop Methods
938 @section Connecting to a remote host using multiple hops
939 @cindex multi-hop methods
940 @cindex methods, multi-hop
942 Sometimes, the methods described before are not sufficient. Sometimes,
943 it is not possible to connect to a remote host using a simple command.
944 For example, if you are in a secured network, you might have to log in
945 to a `bastion host' first before you can connect to the outside world.
946 Of course, the target host may also require a bastion host. The format
947 of multi-hop filenames is slightly different than the format of normal
952 A multi-hop file name specifies a method, a number of hops, and a
953 localname (path name on the remote system). The method name is always
956 Each hop consists of a @dfn{hop method} specification, a user name and
957 a host name. The hop method can be an inline method only. The
958 following hop methods are (currently) available:
962 @cindex hop method telnet
963 @cindex telnet hop method
965 Uses the well-known @command{telnet} program to connect to the host.
966 Whereas user name and host name are supplied in the file name, the
967 user is queried for the password.
970 @cindex hop method rsh
971 @cindex rsh hop method
973 This uses @command{rsh} to connect to the host. You do not need to
974 enter a password unless @command{rsh} explicitly asks for it.
976 The variant @option{remsh} uses the @command{remsh} command. It
977 should be applied on machines where @command{remsh} is used instead of
981 @cindex hop method ssh
982 @cindex ssh hop method
984 This uses @command{ssh} to connect to the host. You might have to enter
985 a password or a pass phrase.
988 @cindex hop method su
989 @cindex su hop method
991 This method does not actually contact a different host, but it allows
992 you to become a different user on the host you're currently on. This
993 might be useful if you want to edit files as root, but the remote host
994 does not allow remote root logins. In this case you can use
995 @option{telnet}, @option{rsh} or @option{ssh} to connect to the
996 remote host as a non-root user, then use an @option{su} hop to become
997 root. But @option{su} need not be the last hop in a sequence, you could
998 also use it somewhere in the middle, if the need arises.
1000 Even though you @emph{must} specify both user and host with an
1001 @option{su} hop, the host name is ignored and only the user name is
1005 @cindex hop method sudo
1006 @cindex sudo hop method
1008 This is similar to the @option{su} hop, except that it uses
1009 @command{sudo} rather than @command{su} to become a different user.
1013 Some people might wish to use port forwarding with @command{ssh} or
1014 maybe they have to use a nonstandard port. This can be accomplished
1015 by putting a stanza in @file{~/.ssh/config} for the account which
1016 specifies a different port number for a certain host name. But it can
1017 also be accomplished within @tramp{}, by adding a multi-hop method.
1022 'tramp-multi-connection-function-alist
1023 '("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n"))
1026 Now you can use an @code{sshf} hop which connects to port 4400 instead of
1030 @node Default Method
1031 @section Selecting a default method
1032 @cindex default method
1034 @vindex tramp-default-method
1035 When you select an appropriate transfer method for your typical usage
1036 you should set the variable @code{tramp-default-method} to reflect that
1037 choice. This variable controls which method will be used when a method
1038 is not specified in the @tramp{} file name. For example:
1041 (setq tramp-default-method "scp")
1044 @vindex tramp-default-method-alist
1045 You can also specify different methods for certain user/host
1046 combinations, via the variable @code{tramp-default-method-alist}. For
1047 example, the following two lines specify to use the @option{ssh}
1048 method for all user names matching @samp{john} and the @option{rsync}
1049 method for all host names matching @samp{lily}. The third line
1050 specifies to use the @option{su} method for the user @samp{root} on
1051 the machine @samp{localhost}.
1054 (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
1055 (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1056 (add-to-list 'tramp-default-method-alist
1057 '("\\`localhost\\'" "\\`root\\'" "su"))
1061 See the documentation for the variable
1062 @code{tramp-default-method-alist} for more details.
1064 External transfer methods are normally preferable to inline transfer
1065 methods, giving better performance. They may not be useful if you use
1066 many remote machines where you cannot log in without a password.
1068 @xref{Inline methods}.
1069 @xref{External transfer methods}.
1070 @xref{Multi-hop Methods}.
1072 Another consideration with the selection of transfer methods is the
1073 environment you will use them in and, especially when used over the
1074 Internet, the security implications of your preferred method.
1076 The @command{rsh} and @command{telnet} methods send your password as
1077 plain text as you log in to the remote machine, as well as transferring
1078 the files in such a way that the content can easily be read from other
1081 If you need to connect to remote systems that are accessible from the
1082 Internet, you should give serious thought to using @command{ssh} based
1083 methods to connect. These provide a much higher level of security,
1084 making it a non-trivial exercise for someone to obtain your password or
1085 read the content of the files you are editing.
1088 @subsection Which method is the right one for me?
1089 @cindex choosing the right method
1091 Given all of the above, you are probably thinking that this is all fine
1092 and good, but it's not helping you to choose a method! Right you are.
1093 As a developer, we don't want to boss our users around but give them
1094 maximum freedom instead. However, the reality is that some users would
1095 like to have some guidance, so here I'll try to give you this guidance
1096 without bossing you around. You tell me whether it works @dots{}
1098 My suggestion is to use an inline method. For large files, out-of-band
1099 methods might be more efficient, but I guess that most people will want
1100 to edit mostly small files.
1102 I guess that these days, most people can access a remote machine by
1103 using @code{ssh}. So I suggest that you use the @code{ssh} method.
1104 So, type @kbd{C-x C-f /ssh:root@@otherhost:/etc/motd @key{RET}} to
1105 edit the @file{/etc/motd} file on the other host.
1107 If you can't use @code{ssh} to log in to the remote host, then select a
1108 method that uses a program that works. For instance, Windows users
1109 might like the @code{plink} method which uses the PuTTY implementation
1110 of @code{ssh}. Or you use Kerberos and thus like @code{krlogin}.
1112 For the special case of editing files on the local host as another
1113 user, see the @code{su} or @code{sudo} method.
1115 People who edit large files may want to consider @code{scp} instead of
1116 @code{ssh}, or @code{pscp} instead of @code{plink}. These out-of-band
1117 methods are faster than inline methods for large files. Note, however,
1118 that out-of-band methods suffer from some limitations. Please try
1119 first whether you really get a noticeable speed advantage from using an
1120 out-of-band method! Maybe even for large files, inline methods are
1123 The reason why I'm suggesting to use inline methods is that they work
1124 even if the remote end is asking you for a password. Out-of-band
1125 methods don't work in this situation. Also, multi-hop methods are
1129 @node Customizing Methods
1130 @section Using Non-Standard Methods
1131 @cindex customizing methods
1132 @cindex using non-standard methods
1133 @cindex create your own methods
1135 There is a variable @code{tramp-methods} which you can change if the
1136 predefined methods don't seem right.
1138 For the time being, I'll refer you to the Lisp documentation of that
1139 variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1142 @node Customizing Completion
1143 @section Selecting config files for user/host name completion
1144 @cindex customizing completion
1145 @cindex selecting config files
1146 @vindex tramp-completion-function-alist
1148 The variable @code{tramp-completion-function-alist} is intended to
1149 customize which files are taken into account for user and host name
1150 completion (@pxref{Filename completion}). For every method, it keeps
1151 a set of configuration files, accompanied by a Lisp function able to
1152 parse that file. Entries in @code{tramp-completion-function-alist}
1153 have the form (@var{method} @var{pair1} @var{pair2} ...).
1155 Each @var{pair} is composed of (@var{function} @var{file}).
1156 @var{function} is responsible to extract user names and host names
1157 from @var{file} for completion. There are two functions which access
1160 @defun tramp-get-completion-function method
1161 This function returns the list of completion functions for @var{method}.
1165 (tramp-get-completion-function "rsh")
1167 @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1168 (tramp-parse-rhosts "~/.rhosts"))
1172 @defun tramp-set-completion-function method function-list
1173 This function sets @var{function-list} as list of completion functions
1178 (tramp-set-completion-function "ssh"
1179 '((tramp-parse-sconfig "/etc/ssh_config")
1180 (tramp-parse-sconfig "~/.ssh/config")))
1182 @result{} ((tramp-parse-sconfig "/etc/ssh_config")
1183 (tramp-parse-sconfig "~/.ssh/config"))
1187 The following predefined functions parsing configuration files exist:
1190 @item @code{tramp-parse-rhosts}
1191 @findex tramp-parse-rhosts
1193 This function parses files which are syntactical equivalent to
1194 @file{~/.rhosts}. It returns both host names and user names, if
1197 @item @code{tramp-parse-shosts}
1198 @findex tramp-parse-shosts
1200 This function parses files which are syntactical equivalent to
1201 @file{~/.ssh/known_hosts}. Since there are no user names specified
1202 in such files, it can return host names only.
1204 @item @code{tramp-parse-sconfig}
1205 @findex tramp-parse-shosts
1207 This function returns the host nicknames defined by @code{Host} entries
1208 in @file{~/.ssh/config} style files.
1210 @item @code{tramp-parse-shostkeys}
1211 @findex tramp-parse-shostkeys
1213 SSH2 parsing of directories @file{/etc/ssh2/hostkeys/*} and
1214 @file{~/ssh2/hostkeys/*}. Hosts are coded in file names
1215 @file{hostkey_PORTNUMBER_HOST-NAME.pub}. User names are always nil.
1217 @item @code{tramp-parse-sknownhosts}
1218 @findex tramp-parse-shostkeys
1220 Another SSH2 style parsing of directories like
1221 @file{/etc/ssh2/knownhosts/*} and @file{~/ssh2/knownhosts/*}. This
1222 case, hosts names are coded in file names
1223 @file{HOST-NAME.ALGORITHM.pub}. User names are always nil.
1225 @item @code{tramp-parse-hosts}
1226 @findex tramp-parse-hosts
1228 A function dedicated to @file{/etc/hosts} style files. It returns
1231 @item @code{tramp-parse-passwd}
1232 @findex tramp-parse-passwd
1234 A function which parses @file{/etc/passwd} like files. Obviously, it
1235 can return user names only.
1237 @item @code{tramp-parse-netrc}
1238 @findex tramp-parse-netrc
1240 Finally, a function which parses @file{~/.netrc} like files.
1243 If you want to keep your own data in a file, with your own structure,
1244 you might provide such a function as well. This function must meet
1245 the following conventions:
1247 @defun my-tramp-parse file
1248 @var{file} must be either a file name on your host, or @code{nil}. The
1249 function must return a list of (@var{user} @var{host}), which are
1250 taken as candidates for user and host name completion.
1254 (my-tramp-parse "~/.my-tramp-hosts")
1256 @result{} ((nil "toto") ("daniel" "melancholia"))
1261 @node Password caching
1262 @section Reusing passwords for several connections.
1265 Sometimes it is necessary to connect to the same remote host several
1266 times. Reentering passwords again and again would be annoying, when
1267 the choosen method does not support access without password prompt
1268 throught own configuration.
1270 By default, @tramp{} caches the passwords entered by you. They will
1271 be reused next time if a connection needs them for the same user name
1272 and host name, independant of the connection method.
1274 @vindex password-cache-expiry
1275 Passwords are not saved permanently, that means the password caching
1276 is limited to the lifetime of your @value{emacs-name} session. You
1277 can influence the lifetime of password caching by customizing the
1278 variable @code{password-cache-expiry}. The value is the number of
1279 seconds how long passwords are cached. Setting it to @code{nil}
1280 disables the expiration.
1282 @findex tramp-clear-passwd
1283 A password is removed from the cache if a connection isn't established
1284 successfully. You can remove a password from the cache also by
1285 executing @kbd{M-x tramp-clear-passwd} in a buffer containing a
1286 related remote file or directory.
1288 @vindex password-cache
1289 If you don't like this feature for security reasons, password caching
1290 can be disabled totally by customizing the variable
1291 @code{password-cache} (setting it to @code{nil}).
1293 Implementation Note: password caching is based on the package
1294 password.el in No Gnus. For the time being, it is activated only when
1295 this package is seen in the @code{load-path} while loading @tramp{}.
1297 If you don't use No Gnus, you can take password.el from the @tramp{}
1298 @file{contrib} directory, see @ref{Installation parameters}.
1300 It will be activated mandatory once No Gnus has found its way into
1304 @node Remote Programs
1305 @section How @tramp{} finds and uses programs on the remote machine.
1307 @tramp{} depends on a number of programs on the remote host in order to
1308 function, including @command{ls}, @command{test}, @command{find} and
1311 In addition to these required tools, there are various tools that may be
1312 required based on the connection method. See @ref{Inline methods} and
1313 @ref{External transfer methods} for details on these.
1315 Certain other tools, such as @command{perl} (or @command{perl5}) and
1316 @command{grep} will be used if they can be found. When they are
1317 available, they are used to improve the performance and accuracy of
1320 @vindex tramp-remote-path
1321 When @tramp{} connects to the remote machine, it searches for the
1322 programs that it can use. The variable @var{tramp-remote-path} controls
1323 the directories searched on the remote machine.
1325 By default, this is set to a reasonable set of defaults for most
1326 machines. It is possible, however, that your local (or remote ;) system
1327 administrator has put the tools you want in some obscure local
1330 In this case, you can still use them with @tramp{}. You simply need to
1331 add code to your @file{.emacs} to add the directory to the remote path.
1332 This will then be searched by @tramp{} when you connect and the software
1335 To add a directory to the remote search path, you could use code such
1339 @i{;; We load @tramp{} to define the variable.}
1341 @i{;; We have @command{perl} in "/usr/local/perl/bin"}
1342 (add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1346 @node Remote shell setup
1347 @comment node-name, next, previous, up
1348 @section Remote shell setup hints
1349 @cindex remote shell setup
1350 @cindex @file{.profile} file
1351 @cindex @file{.login} file
1352 @cindex shell init files
1354 As explained in the @ref{Overview} section, @tramp{} connects to the
1355 remote host and talks to the shell it finds there. Of course, when you
1356 log in, the shell executes its init files. Suppose your init file
1357 requires you to enter the birth date of your mother; clearly @tramp{}
1358 does not know this and hence fails to log you in to that host.
1360 There are different possible strategies for pursuing this problem. One
1361 strategy is to enable @tramp{} to deal with all possible situations.
1362 This is a losing battle, since it is not possible to deal with
1363 @emph{all} situations. The other strategy is to require you to set up
1364 the remote host such that it behaves like @tramp{} expects. This might
1365 be inconvenient because you have to invest a lot of effort into shell
1366 setup before you can begin to use @tramp{}.
1368 The package, therefore, pursues a combined approach. It tries to figure
1369 out some of the more common setups, and only requires you to avoid
1370 really exotic stuff. For example, it looks through a list of
1371 directories to find some programs on the remote host. And also, it
1372 knows that it is not obvious how to check whether a file exists, and
1373 therefore it tries different possibilities. (On some hosts and shells,
1374 the command @code{test -e} does the trick, on some hosts the shell
1375 builtin doesn't work but the program @code{/usr/bin/test -e} or
1376 @code{/bin/test -e} works. And on still other hosts, @code{ls -d} is
1377 the right way to do this.)
1379 Below you find a discussion of a few things that @tramp{} does not deal
1380 with, and that you therefore have to set up correctly.
1383 @item @var{shell-prompt-pattern}
1384 @vindex shell-prompt-pattern
1386 After logging in to the remote host, @tramp{} has to wait for the remote
1387 shell startup to finish before it can send commands to the remote
1388 shell. The strategy here is to wait for the shell prompt. In order to
1389 recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1390 to be set correctly to recognize the shell prompt on the remote host.
1392 Note that @tramp{} requires the match for @code{shell-prompt-pattern}
1393 to be at the end of the buffer. Many people have something like the
1394 following as the value for the variable: @code{"^[^>$][>$] *"}. Now
1395 suppose your shell prompt is @code{a <b> c $ }. In this case,
1396 @tramp{} recognizes the @code{>} character as the end of the prompt,
1397 but it is not at the end of the buffer.
1399 @item @var{tramp-shell-prompt-pattern}
1400 @vindex tramp-shell-prompt-pattern
1402 This regular expression is used by @tramp{} in the same way as
1403 @code{shell-prompt-pattern}, to match prompts from the remote shell.
1404 This second variable exists because the prompt from the remote shell
1405 might be different from the prompt from a local shell --- after all,
1406 the whole point of @tramp{} is to log in to remote hosts as a
1407 different user. The default value of
1408 @code{tramp-shell-prompt-pattern} is the same as the default value of
1409 @code{shell-prompt-pattern}, which is reported to work well in many
1412 @item @code{tset} and other questions
1413 @cindex Unix command tset
1414 @cindex tset Unix command
1416 Some people invoke the @code{tset} program from their shell startup
1417 scripts which asks the user about the terminal type of the shell.
1418 Maybe some shells ask other questions when they are started. @tramp{}
1419 does not know how to answer these questions. There are two approaches
1420 for dealing with this problem. One approach is to take care that the
1421 shell does not ask any questions when invoked from @tramp{}. You can
1422 do this by checking the @code{TERM} environment variable, it will be
1423 set to @code{dumb} when connecting.
1425 @vindex tramp-terminal-type
1426 The variable @code{tramp-terminal-type} can be used to change this value
1429 The other approach is to teach @tramp{} about these questions. See
1430 the variables @code{tramp-actions-before-shell} and
1431 @code{tramp-multi-actions} (for multi-hop connections).
1434 @item Environment variables named like users in @file{.profile}
1436 If you have a user named frumple and set the variable @code{FRUMPLE} in
1437 your shell environment, then this might cause trouble. Maybe rename
1438 the variable to @code{FRUMPLE_DIR} or the like.
1440 This weird effect was actually reported by a @tramp{} user!
1443 @item Non-Bourne commands in @file{.profile}
1445 After logging in to the remote host, @tramp{} issues the command
1446 @code{exec /bin/sh}. (Actually, the command is slightly different.)
1447 When @code{/bin/sh} is executed, it reads some init files, such as
1448 @file{~/.shrc} or @file{~/.profile}.
1450 Now, some people have a login shell which is not @code{/bin/sh} but a
1451 Bourne-ish shell such as bash or ksh. Some of these people might put
1452 their shell setup into the files @code{~/.shrc} or @code{~/.profile}.
1453 This way, it is possible for non-Bourne constructs to end up in those
1454 files. Then, @code{exec /bin/sh} might cause the Bourne shell to barf
1455 on those constructs.
1457 As an example, imagine somebody putting @code{export FOO=bar} into the
1458 file @file{~/.profile}. The standard Bourne shell does not understand
1459 this syntax and will emit a syntax error when it reaches this line.
1461 Another example is the tilde (@code{~}) character, say when adding
1462 @file{~/bin} to @code{$PATH}. Many Bourne shells will not expand this
1463 character, and since there is usually no directory whose name consists
1464 of the single character tilde, strange things will happen.
1466 What can you do about this?
1468 Well, one possibility is to make sure that everything in @file{~/.shrc}
1469 and @file{~/.profile} on all remote hosts is Bourne-compatible. In the
1470 above example, instead of @code{export FOO=bar}, you might use
1471 @code{FOO=bar; export FOO} instead.
1473 The other possibility is to put your non-Bourne shell setup into some
1474 other files. For example, bash reads the file @file{~/.bash_profile}
1475 instead of @file{~/.profile}, if the former exists. So bash
1476 aficionados just rename their @file{~/.profile} to
1477 @file{~/.bash_profile} on all remote hosts, and Bob's your uncle.
1479 The @tramp{} developers would like to circumvent this problem, so if you
1480 have an idea about it, please tell us. However, we are afraid it is not
1481 that simple: before saying @code{exec /bin/sh}, @tramp{} does not know
1482 which kind of shell it might be talking to. It could be a Bourne-ish
1483 shell like ksh or bash, or it could be a csh derivative like tcsh, or
1484 it could be zsh, or even rc. If the shell is Bourne-ish already, then
1485 it might be prudent to omit the @code{exec /bin/sh} step. But how to
1486 find out if the shell is Bourne-ish?
1491 @node Auto-save and Backup
1492 @section Auto-save and Backup configuration
1495 @vindex backup-directory-alist
1497 Normally, @value{emacs-name} writes backup files to the same directory
1498 as the original files, but this behavior can be changed via the
1499 variable @code{backup-directory-alist}. In connection with @tramp{},
1500 this can have unexpected side effects. Suppose that you specify that
1501 all backups should go to the directory @file{~/.emacs.d/backups/}, and
1502 then you edit the file @file{/su:root@@localhost:/etc/secretfile}.
1503 The effect is that the backup file will be owned by you and not by
1504 root, thus possibly enabling others to see it even if they were not
1507 When @code{backup-directory-alist} is nil (the default), such problems
1510 If you wish to customize the variable, the workaround is to include
1511 special settings for @tramp{} files. For example, the following statement
1512 effectively `turns off' the effect of @code{backup-directory-alist} for
1517 (add-to-list 'backup-directory-alist
1518 (cons tramp-file-name-regexp nil))
1521 The same problem can happen with auto-saving files.
1523 Since @value{emacs-name} 21, the variable
1524 @code{auto-save-file-name-transforms} keeps information, on which
1525 directory an auto-saved file should go. By default, it is initialized
1526 for @tramp{} files to the local temporary directory.
1528 On some versions of @value{emacs-name}, namely the version built for
1529 Debian Linux, the variable @code{auto-save-file-name-transforms}
1530 contains the directory where @value{emacs-name} was built. A
1531 workaround is to manually set the variable to a sane value.
1533 If auto-saved files should go into the same directory as the original
1534 files, @code{auto-save-file-name-transforms} should be set to nil.
1536 Another possibility is to set the variable
1537 @code{tramp-auto-save-directory} to a proper value.
1540 For this purpose you can set the variable
1541 @code{tramp-auto-save-directory} to a proper value.
1545 @node Windows setup hints
1546 @section Issues with Cygwin ssh
1547 @cindex Cygwin, issues
1549 This section needs a lot of work! Please help.
1551 @cindex method sshx with Cygwin
1552 @cindex sshx method with Cygwin
1553 If you use the Cygwin installation of ssh (you have to explicitly select
1554 it in the installer), then it should work out of the box to just select
1555 @code{sshx} as the connection method. You can find information about
1556 setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}.
1558 @cindex method scpx with Cygwin
1559 @cindex scpx method with Cygwin
1560 If you wish to use the @code{scpx} connection method, then you might
1561 have the problem that @value{emacs-name} calls @code{scp} with a
1562 Windows filename such as @code{c:/foo}. The Cygwin version of
1563 @code{scp} does not know about Windows filenames and interprets this
1564 as a remote filename on the host @code{c}.
1566 One possible workaround is to write a wrapper script for @code{scp}
1567 which converts the Windows filename to a Cygwinized filename.
1569 I guess that another workaround is to run @value{emacs-name} under
1570 Cygwin, or to run a Cygwinized @value{emacs-name}.
1572 @cindex Cygwin and ssh-agent
1573 @cindex SSH_AUTH_SOCK and @value{emacs-name} on Windows
1574 If you want to use either @code{ssh} based method on Windows, then you
1575 might encounter problems with @code{ssh-agent}. Using this program,
1576 you can avoid typing the pass-phrase every time you log in (and the
1577 @code{scpx} method more or less requires you to use @code{ssh-agent}
1578 because it does not allow you to type a password or pass-phrase).
1579 However, if you start @value{emacs-name} from a desktop shortcut, then
1580 the environment variable @code{SSH_AUTH_SOCK} is not set and so
1581 @value{emacs-name} and thus @tramp{} and thus @code{ssh} and
1582 @code{scp} started from @tramp{} cannot communicate with
1583 @code{ssh-agent}. It works better to start @value{emacs-name} from
1586 If anyone knows how to start @code{ssh-agent} under Windows in such a
1587 way that desktop shortcuts can profit, please holler. I don't really
1588 know anything at all about Windows@dots{}
1592 @chapter Using @tramp{}
1593 @cindex using @tramp{}
1595 Once you have installed @tramp{} it will operate fairly transparently. You
1596 will be able to access files on any remote machine that you can log in
1597 to as though they were local.
1599 Files are specified to @tramp{} using a formalized syntax specifying the
1600 details of the system to connect to. This is similar to the syntax used
1601 by the @value{ftp-package-name} package.
1604 Something that might happen which surprises you is that
1605 @value{emacs-name} remembers all your keystrokes, so if you see a
1606 password prompt from @value{emacs-name}, say, and hit @kbd{@key{RET}}
1607 twice instead of once, then the second keystroke will be processed by
1608 @value{emacs-name} after @tramp{} has done its thing. Why, this
1609 type-ahead is normal behavior, you say. Right you are, but be aware
1610 that opening a remote file might take quite a while, maybe half a
1611 minute when a connection needs to be opened. Maybe after half a
1612 minute you have already forgotten that you hit that key!
1615 * Filename Syntax:: @tramp{} filename conventions.
1616 * Multi-hop filename syntax:: Multi-hop filename conventions.
1617 * Filename completion:: Filename completion.
1622 @node Filename Syntax
1623 @section @tramp{} filename conventions
1624 @cindex filename syntax
1625 @cindex filename examples
1627 To access the file @var{localname} on the remote machine @var{machine} you
1628 would specify the filename
1629 @file{@value{tramp-prefix}@var{machine}@value{tramp-postfix}@var{localname}}.
1630 This will connect to @var{machine} and transfer the file using the
1631 default method. @xref{Default Method}.
1633 Some examples of @tramp{} filenames are shown below.
1636 @item @value{tramp-prefix}melancholia@value{tramp-postfix}.emacs
1637 Edit the file @file{.emacs} in your home directory on the machine
1640 @item @value{tramp-prefix}melancholia.danann.net@value{tramp-postfix}.emacs
1641 This edits the same file, using the fully qualified domain name of
1644 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~/.emacs
1645 This also edits the same file --- the @file{~} is expanded to your
1646 home directory on the remote machine, just like it is locally.
1648 @item @value{tramp-prefix}melancholia@value{tramp-postfix}~daniel/.emacs
1649 This edits the file @file{.emacs} in the home directory of the user
1650 @code{daniel} on the machine @code{melancholia}. The @file{~<user>}
1651 construct is expanded to the home directory of that user on the remote
1654 @item @value{tramp-prefix}melancholia@value{tramp-postfix}/etc/squid.conf
1655 This edits the file @file{/etc/squid.conf} on the machine
1660 Unless you specify a different name to use, @tramp{} will use the
1661 current local user name as the remote user name to log in with. If you
1662 need to log in as a different user, you can specify the user name as
1663 part of the filename.
1665 To log in to the remote machine as a specific user, you use the syntax
1666 @file{@value{tramp-prefix}@var{user}@@@var{machine}@value{tramp-postfix}/@var{path/to.file}}.
1667 That means that connecting to @code{melancholia} as @code{daniel} and
1668 editing @file{.emacs} in your home directory you would specify
1669 @file{@value{tramp-prefix}daniel@@melancholia@value{tramp-postfix}.emacs}.
1671 It is also possible to specify other file transfer methods
1672 (@pxref{Default Method}) as part of the filename.
1674 This is done by putting the method before the user and host name, as
1676 @file{@value{tramp-prefix}@var{method}@value{tramp-postfix-single-hop}}
1677 (Note the trailing colon).
1680 This is done by replacing the initial
1681 @file{@value{tramp-prefix}} with
1682 @file{@value{tramp-prefix}<method>@value{tramp-postfix-single-hop}}.
1683 (Note the trailing slash!).
1685 The user, machine and file specification remain the same.
1687 So, to connect to the machine @code{melancholia} as @code{daniel},
1688 using the @option{ssh} method to transfer files, and edit @file{.emacs}
1689 in my home directory I would specify the filename
1690 @file{@value{tramp-prefix}ssh@value{tramp-postfix-single-hop}daniel@@melancholia@value{tramp-postfix}.emacs}.
1693 @node Multi-hop filename syntax
1694 @section Multi-hop filename conventions
1695 @cindex filename syntax for multi-hop files
1696 @cindex multi-hop filename syntax
1698 The syntax of multi-hop file names is necessarily slightly different
1699 than the syntax of other @tramp{} file names. Here's an example
1700 multi-hop file name:
1703 @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
1706 This is quite a mouthful. So let's go through it step by step. The
1707 file name consists of three parts.
1709 The parts are separated by colons
1712 The parts are separated by slashes and square brackets.
1714 The first part is @file{@value{tramp-prefix}multi}, the method
1715 specification. The second part is
1716 @file{rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host}
1717 and specifies the hops. The final part is @file{/path/to.file} and
1718 specifies the file name on the remote host.
1720 The first part and the final part should be clear. See @ref{Multi-hop
1721 Methods}, for a list of alternatives for the method specification.
1723 The second part can be subdivided again into components, so-called
1724 hops. In the above file name, there are two hops,
1725 @file{rsh@value{tramp-postfix-multi-hop}out@@gate} and
1726 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}.
1728 Each hop can @emph{again} be subdivided into (three) components, the
1729 @dfn{hop method}, the @dfn{user name} and the @dfn{host name}. The
1730 meaning of the second and third component should be clear, and the hop
1731 method says what program to use to perform that hop.
1733 The first hop, @file{rsh@value{tramp-postfix-multi-hop}out@@gate},
1734 says to use @command{rsh} to log in as user @code{out} to the host
1735 @code{gate}. Starting at that host, the second hop,
1736 @file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}, says to
1737 use @command{telnet} to log in as user @code{kai} to host
1740 @xref{Multi-hop Methods}, for a list of possible hop method values.
1741 The variable @code{tramp-multi-connection-function-alist} contains the
1742 list of possible hop methods and information on how to execute them,
1743 should you want to add your own.
1746 @node Filename completion
1747 @section Filename completion
1748 @cindex filename completion
1750 Filename completion works with @tramp{} for both completing methods,
1751 user names and machine names (except multi hop methods) as well as for
1752 files on remote machines.
1754 If you, for example, type @kbd{C-x C-f @value{tramp-prefix}t
1755 @key{TAB}}, @tramp{} might give you as result the choice for
1759 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop} tmp/
1760 @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1763 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop} @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1767 @samp{@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}}
1768 is a possible completion for the respective method,
1770 @samp{tmp/} stands for the directory @file{/tmp} on your local
1773 and @samp{@value{tramp-prefix-single-hop}toto@value{tramp-postfix}}
1774 might be a host @tramp{} has detected in your @file{~/.ssh/known_hosts}
1775 file (given you're using default method @option{ssh}).
1777 If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
1778 @samp{@value{tramp-prefix}telnet@value{tramp-postfix-single-hop}}.
1779 Next @kbd{@key{TAB}} brings you all machine names @tramp{} detects in
1780 your @file{/etc/hosts} file, let's say
1783 @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}
1784 @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}
1785 @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia@value{tramp-postfix}
1788 Now you can choose the desired machine, and you can continue to
1789 complete file names on that machine.
1791 As filename completion needs to fetch the listing of files from the
1792 remote machine, this feature is sometimes fairly slow. As @tramp{}
1793 does not yet cache the results of directory listing, there is no gain
1794 in performance the second time you complete filenames.
1796 If the configuration files (@pxref{Customizing Completion}), which
1797 @tramp{} uses for analysis of completion, offer user names, those user
1798 names will be taken into account as well.
1805 @tramp{} works transparently with dired, enabling you to use this powerful
1806 file management tool to manage files on any machine you have access to
1809 If you need to browse a directory tree, Dired is a better choice, at
1810 present, than filename completion. Dired has its own cache mechanism
1811 and will only fetch the directory listing once.
1815 @chapter Reporting Bugs and Problems
1818 Bugs and problems with @tramp{} are actively worked on by the development
1819 team. Feature requests and suggestions are also more than welcome.
1821 The @tramp{} mailing list is a great place to get information on working
1822 with @tramp{}, solving problems and general discussion and advice on topics
1823 relating to the package.
1825 The mailing list is at @email{tramp-devel@@mail.freesoftware.fsf.org}.
1826 Messages sent to this address go to all the subscribers. This is
1827 @emph{not} the address to send subscription requests to.
1829 For help on subscribing to the list, send mail to the administrative
1830 address, @email{tramp-devel-request@@mail.freesoftware.fsf.org}, with the
1831 subject @samp{help}.
1833 To report a bug in @tramp{}, you should execute @kbd{M-x tramp-bug}. This
1834 will automatically generate a buffer with the details of your system and
1837 When submitting a bug report, please try to describe in excruciating
1838 detail the steps required to reproduce the problem, the setup of the
1839 remote machine and any special conditions that exist.
1841 If you can identify a minimal test case that reproduces the problem,
1842 include that with your bug report. This will make it much easier for the
1843 development team to analyze and correct the problem.
1845 @node Frequently Asked Questions
1846 @chapter Frequently Asked Questions
1847 @cindex frequently asked questions
1852 Where can I get the latest @tramp{}?
1854 @tramp{} is available under the URL below.
1857 @uref{http://savannah.nongnu.org/download/tramp/}
1860 There is also a Savannah project page.
1863 @uref{http://savannah.nongnu.org/projects/tramp/}
1866 Which systems does it work on?
1868 The package has been used successfully on Emacs 20 and Emacs 21, as well
1869 as XEmacs 21. XEmacs 20 is more problematic, see the notes in
1870 @file{tramp.el}. I don't think anybody has really tried it on Emacs 19.
1872 The package was intended to work on Unix, and it really expects a
1873 Unix-like system on the remote end (except the @option{smb} method),
1874 but some people seemed to have some success getting it to work on NT
1877 There is some informations on @tramp{} on NT at the following URL;
1878 many thanks to Joe Stoy for providing the information:
1879 @uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}
1881 The above mostly contains patches to old ssh versions; Tom Roche has a
1882 Web page with instructions:
1883 @uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
1885 ??? Is the XEmacs info correct?
1887 ??? Can somebody provide some information for getting it to work on NT
1888 Emacs? I think there was some issue with @command{ssh}?
1892 I can't stop @value{ftp-package-name} starting with @value{emacs-name}
1895 @value{ftp-package-name} is loaded from @tramp{} automatically if you
1896 require a file by the ftp method. Unfortunately, there are some Lisp
1897 packages which make @value{ftp-package-name} file name handlers active.
1898 You can see it applying @kbd{C-h v file-name-handler-alist}:
1901 file-name-handler-alist's value is
1902 (("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
1903 ("^/[^/:]*[^/:.]:" . ange-ftp-hook-function)
1904 ("^/[^/]*$" . tramp-completion-file-name-handler)
1905 ("\\`/[^/:]+:" . tramp-file-name-handler)
1906 ("\\`/:" . file-name-non-special))
1909 Please try to find out which package is responsible for loading
1910 @value{ftp-package-name}, and raise a bug report.
1912 A workaround is to require @value{ftp-package-name} before @tramp{} in
1913 your @file{~/.emacs}, because @tramp{} cleans up the entries in
1914 @code{file-name-handler-alist}:
1917 ;; @value{ftp-package-name} temporarily required
1919 ;; @tramp{} cleans up @code{file-name-handler-alist}
1925 Not all the older versions of @tramp{} supported @value{emacs-name}
1926 correctly. The first thing to do is to make sure that you have the
1927 latest version of @tramp{} installed.
1929 If you do, please try and find out exactly the conditions required for
1930 the @value{ftp-package-name} handlers to fire. If you can, putting a
1931 breakpoint on @code{efs-ftp-path} and sending in the stack trace along
1932 with your bug report would make it easier for the developers to work out
1933 what is going wrong.
1938 File name completion does not work with @tramp{}
1940 When you log in to the remote machine, do you see the output of
1941 @command{ls} in color? If so, this may be the cause of your problems.
1943 @command{ls} outputs @acronym{ANSI} escape sequences that your terminal
1944 emulator interprets to set the colors. These escape sequences will
1945 confuse @tramp{} however.
1947 In your @file{.bashrc}, @file{.profile} or equivalent on the remote
1948 machine you probably have an alias configured that adds the option
1949 @option{--color=yes} or @option{--color=auto}.
1951 You should remove that alias and ensure that a new login @emph{does not}
1952 display the output of @command{ls} in color. If you still cannot use
1953 filename completion, report a bug to the @tramp{} developers.
1957 File name completion does not work in large directories
1959 @tramp{} uses globbing for some operations. (Globbing means to use the
1960 shell to expand wildcards such as `*.c'.) This might create long
1961 command lines, especially in directories with many files. Some shells
1962 choke on long command lines, or don't cope well with the globbing
1965 If you have a large directory on the remote end, you may wish to execute
1966 a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
1967 Note that you must first start the right shell, which might be
1968 @command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
1969 of those supports tilde expansion.
1973 What kinds of systems does @tramp{} work on
1975 @tramp{} really expects the remote system to be a Unix-like system. The
1976 local system should preferably be Unix-like, as well, but @tramp{} might
1977 work on NT with some tweaking.
1981 How can I get notified when @tramp{} file transfers are complete?
1983 The following snippet can be put in your @file{~/.emacs} file. It
1984 makes @value{emacs-name} beep after reading from or writing to the
1988 (defadvice tramp-handle-write-region
1989 (after tramp-write-beep-advice activate)
1990 " make tramp beep after writing a file."
1993 (defadvice tramp-handle-do-copy-or-rename-file
1994 (after tramp-copy-beep-advice activate)
1995 " make tramp beep after copying a file."
1998 (defadvice tramp-handle-insert-file-contents
1999 (after tramp-copy-beep-advice activate)
2000 " make tramp beep after copying a file."
2007 There's this @file{~/.sh_history} file on the remote host which keeps
2008 growing and growing. What's that?
2010 Sometimes, @tramp{} starts @code{ksh} on the remote host for tilde
2011 expansion. Maybe @code{ksh} saves the history by default. @tramp{}
2012 tries to turn off saving the history, but maybe you have to help. For
2013 example, you could put this in your @file{.kshrc}:
2016 if [ -f $HOME/.sh_history ] ; then
2017 /bin/rm $HOME/.sh_history
2019 if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
2022 if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
2028 @item @tramp{} doesn't transfer strings with more than 500 characters
2031 On some few systems, the implementation of @code{process-send-string}
2032 seems to be broken for longer strings. This case, you should
2033 customize the variable @code{tramp-chunksize} to 500. For a
2034 description how to determine whether this is necessary see the
2035 documentation of @code{tramp-chunksize}.
2040 @c For the developer
2041 @node Version Control
2042 @chapter The inner workings of remote version control
2043 @cindex Version Control
2045 Unlike @value{ftp-package-name}, @tramp{} has full shell access to the
2046 remote machine. This makes it possible to provide version control for
2047 files accessed under @tramp{}.
2049 The actual version control binaries must be installed on the remote
2050 machine, accessible in the directories specified in
2051 @var{tramp-remote-path}.
2053 This transparent integration with the version control systems is one of
2054 the most valuable features provided by @tramp{}, but it is far from perfect.
2055 Work is ongoing to improve the transparency of the system.
2058 * Version Controlled Files:: Determining if a file is under version control.
2059 * Remote Commands:: Executing the version control commands on the remote machine.
2060 * Changed workfiles:: Detecting if the working file has changed.
2061 * Checking out files:: Bringing the workfile out of the repository.
2062 * Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
2066 @node Version Controlled Files
2067 @section Determining if a file is under version control
2069 The VC package uses the existence of on-disk revision control master
2070 files to determine if a given file is under revision control. These file
2071 tests happen on the remote machine through the standard @tramp{} mechanisms.
2074 @node Remote Commands
2075 @section Executing the version control commands on the remote machine
2077 There are no hooks provided by VC to allow intercepting of the version
2078 control command execution. The calls occur through the
2079 @code{call-process} mechanism, a function that is somewhat more
2080 efficient than the @code{shell-command} function but that does not
2081 provide hooks for remote execution of commands.
2083 To work around this, the functions @code{vc-do-command} and
2084 @code{vc-simple-command} have been advised to intercept requests for
2085 operations on files accessed via @tramp{}.
2087 In the case of a remote file, the @code{shell-command} interface is
2088 used, with some wrapper code, to provide the same functionality on the
2089 remote machine as would be seen on the local machine.
2092 @node Changed workfiles
2093 @section Detecting if the working file has changed
2095 As there is currently no way to get access to the mtime of a file on a
2096 remote machine in a portable way, the @code{vc-workfile-unchanged-p}
2097 function is advised to call an @tramp{} specific function for remote files.
2099 The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
2100 diff functionality to determine if any changes have occurred between the
2101 workfile and the version control master.
2103 This requires that a shell command be executed remotely, a process that
2104 is notably heavier-weight than the mtime comparison used for local
2105 files. Unfortunately, unless a portable solution to the issue is found,
2106 this will remain the cost of remote version control.
2109 @node Checking out files
2110 @section Bringing the workfile out of the repository
2112 VC will, by default, check for remote files and refuse to act on them
2113 when checking out files from the repository. To work around this
2114 problem, the function @code{vc-checkout} knows about @tramp{} files and
2115 allows version control to occur.
2118 @node Miscellaneous Version Control
2119 @section Things related to Version Control that don't fit elsewhere
2121 Minor implementation details, &c.
2124 * Remote File Ownership:: How VC determines who owns a workfile.
2125 * Back-end Versions:: How VC determines what release your RCS is.
2129 @node Remote File Ownership
2130 @subsection How VC determines who owns a workfile
2132 @value{emacs-name} provides the @code{user-full-name} function to
2133 return the login name of the current user as well as mapping from
2134 arbitrary user id values back to login names. The VC code uses this
2135 functionality to map from the uid of the owner of a workfile to the
2136 login name in some circumstances.
2138 This will not, for obvious reasons, work if the remote system has a
2139 different set of logins. As such, it is necessary to delegate to the
2140 remote machine the job of determining the login name associated with a
2143 Unfortunately, with the profusion of distributed management systems such
2144 as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
2145 reliable and portable method for performing this mapping.
2147 Thankfully, the only place in the VC code that depends on the mapping of
2148 a uid to a login name is the @code{vc-file-owner} function. This returns
2149 the login of the owner of the file as a string.
2151 This function has been advised to use the output of @command{ls} on the
2152 remote machine to determine the login name, delegating the problem of
2153 mapping the uid to the login to the remote system which should know more
2157 @node Back-end Versions
2158 @subsection How VC determines what release your RCS is
2160 VC needs to know what release your revision control binaries you are
2161 running as not all features VC supports are available with older
2162 versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.
2164 The default implementation of VC determines this value the first time it
2165 is needed and then stores the value globally to avoid the overhead of
2166 executing a process and parsing its output each time the information is
2169 Unfortunately, life is not quite so easy when remote version control
2170 comes into the picture. Each remote machine may have a different version
2171 of the version control tools and, while this is painful, we need to
2172 ensure that unavailable features are not used remotely.
2174 To resolve this issue, @tramp{} currently takes the sledgehammer
2175 approach of making the release values of the revision control tools
2176 local to each @tramp{} buffer, forcing VC to determine these values
2177 again each time a new file is visited.
2179 This has, quite obviously, some performance implications. Thankfully,
2180 most of the common operations performed by VC do not actually require
2181 that the remote version be known. This makes the problem far less
2184 Eventually these values will be captured by @tramp{} on a system by
2185 system basis and the results cached to improve performance.
2188 @node Files directories and localnames
2189 @chapter How file names, directories and localnames are mangled and managed.
2192 * Localname deconstruction:: Breaking a localname into its components.
2196 @node Localname deconstruction
2197 @section Breaking a localname into its components.
2199 @tramp{} file names are somewhat different, obviously, to ordinary file
2200 names. As such, the lisp functions @code{file-name-directory} and
2201 @code{file-name-nondirectory} are overridden within the @tramp{}
2204 Their replacements are reasonably simplistic in their approach. They
2205 dissect the filename, call the original handler on the localname and
2206 then rebuild the @tramp{} file name with the result.
2208 This allows the platform specific hacks in the original handlers to take
2209 effect while preserving the @tramp{} file name information.
2213 @chapter Debatable Issues and What Was Decided
2216 @item The uuencode method does not always work.
2218 Due to the design of @tramp{}, the encoding and decoding programs need to
2219 read from stdin and write to stdout. On some systems, @code{uudecode -o
2220 -} will read stdin and write the decoded file to stdout, on other
2221 systems @code{uudecode -p} does the same thing. But some systems have
2222 uudecode implementations which cannot do this at all---it is not
2223 possible to call these uudecode implementations with suitable parameters
2224 so that they write to stdout.
2226 Of course, this could be circumvented: the @code{begin foo 644} line
2227 could be rewritten to put in some temporary file name, then
2228 @code{uudecode} could be called, then the temp file could be printed and
2231 But I have decided that this is too fragile to reliably work, so on some
2232 systems you'll have to do without the uuencode methods.
2234 @item @tramp{} does not work on XEmacs 20.
2236 This is because it requires the macro @code{with-timeout} which does not
2237 appear to exist in XEmacs 20. I'm somewhat reluctant to add an
2238 emulation macro to @tramp{}, but if somebody who uses XEmacs 20 steps
2239 forward and wishes to implement and test it, please contact me or the
2242 @item The @tramp{} filename syntax differs between Emacs and XEmacs.
2244 The Emacs maintainers wish to use a unified filename syntax for
2245 Ange-FTP and @tramp{} so that users don't have to learn a new
2246 syntax. It is sufficient to learn some extensions to the old syntax.
2248 For the XEmacs maintainers, the problems caused from using a unified
2249 filename syntax are greater than the gains. The XEmacs package system
2250 uses EFS for downloading new packages. So, obviously, EFS has to be
2251 installed from the start. If the filenames were unified, @tramp{}
2252 would have to be installed from the start, too.
2255 @strong{Note:} If you'ld like to use a similar syntax like
2256 @value{ftp-package-name}, you need the following settings in your init
2260 (setq tramp-unified-filenames t)
2264 The autoload of the @value{emacs-name} @tramp{} package must be
2265 disabled. This can be achieved by setting file permissions @code{000}
2266 to the files @file{.../xemacs-packages/lisp/tramp/auto-autoloads.el*}.
2268 In case of unified filenames, all @value{emacs-name} download sites
2269 are added to @code{tramp-default-method-alist} with default method
2270 @code{ftp} @xref{Default Method}. These settings shouldn't be touched
2271 for proper working of the @value{emacs-name} package system.
2273 The syntax for unified filenames is described in the @tramp{} manual
2274 for @value{emacs-other-name}.
2280 @comment node-name, next, previous, up
2281 @unnumbered Concept Index
2284 @c End of tramp.texi - the TRAMP User Manual
2289 @c * Say something about the .login and .profile files of the remote
2291 @c * Explain how tramp.el works in principle: open a shell on a remote
2292 @c host and then send commands to it.
2293 @c * Mention that bookmarks are a cool feature to go along with Tramp.
2294 @c * Make terminology "inline" vs "out-of-band" consistent.
2295 @c It seems that "external" is also used instead of "out-of-band".
2298 @c ** Use `filename' resp. `file name' consistently.
2299 @c ** Use `host' resp. `machine' consistently.
2300 @c ** Consistent small or capitalized words especially in menues.
2303 arch-tag: f96dd66e-6dd3-4c92-8d77-9c56205ba808