]> code.delx.au - gnu-emacs/blobdiff - doc/misc/tramp.texi
Follow Glenn's lead and update format of Copyright.
[gnu-emacs] / doc / misc / tramp.texi
index e5cd5e1a33b590121ef59eb7f2d4d0812a612ca5..23a974906dcdc6ae033a09c32bdc934b265992f6 100644 (file)
 @end macro
 
 @copying
-Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-2007 Free Software Foundation, Inc.
+Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
 any later version published by the Free Software Foundation; with no
-Invariant Sections, with the Front-Cover texts being ``A GNU
-Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
-license is included in the section entitled ``GNU Free Documentation
-License'' in the Emacs manual.
-
-(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
-this GNU Manual, like GNU software.  Copies published by the Free
-Software Foundation raise funds for GNU development.''
-
-This document is part of a collection distributed under the GNU Free
-Documentation License.  If you want to distribute this document
-separately from the collection, you can do so by adding a copy of the
-license to the document, as described in section 6 of the license.
+Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
+and with the Back-Cover Texts as in (a) below.  A copy of the license
+is included in the section entitled ``GNU Free Documentation License''.
+
+(a) The FSF's Back-Cover Text is: ``You have the freedom to
+copy and modify this GNU manual.  Buying copies from the FSF
+supports it in developing GNU and promoting software freedom.''
 @end quotation
 @end copying
 
@@ -164,6 +158,8 @@ For the end user:
 * Usage::                       An overview of the operation of @value{tramp}.
 * Bug Reports::                 Reporting Bugs and Problems.
 * Frequently Asked Questions::  Questions and answers from the mailing list.
+* Function Index::              @value{tramp} functions.
+* Variable Index::              User options and variables.
 * Concept Index::               An item for each concept.
 
 For the developer:
@@ -191,7 +187,7 @@ Configuring @value{tramp} for use
 
 * Connection types::            Types of connections made to remote machines.
 * Inline methods::              Inline methods.
-* External transfer methods::   External transfer methods.
+* External methods::            External methods.
 @ifset emacsgw
 * Gateway methods::             Gateway methods.
 @end ifset
@@ -201,7 +197,7 @@ Configuring @value{tramp} for use
 * Multi-hops::                  Connecting to a remote host using multiple hops.
 * Customizing Methods::         Using Non-Standard Methods.
 * Customizing Completion::      Selecting config files for user/host name completion.
-* Password caching::            Reusing passwords for several connections.
+* Password handling::           Reusing passwords for several connections.
 * Connection caching::          Reusing connection related information.
 * Remote Programs::             How @value{tramp} finds and uses programs on the remote machine.
 * Remote shell setup::          Remote shell setup hints.
@@ -214,6 +210,7 @@ Using @value{tramp}
 * Alternative Syntax::          URL-like filename syntax.
 * Filename completion::         Filename completion.
 * Remote processes::            Integration with other @value{emacsname} packages.
+* Cleanup remote connections::  Cleanup remote connections.
 
 The inner workings of remote version control
 
@@ -257,6 +254,9 @@ box, one of the more common uses of the package.  This allows
 relatively secure access to machines, especially if @command{ftp}
 access is disabled.
 
+Under Windows, @value{tramp} is integrated with the PuTTY package,
+using the @command{plink} program.
+
 The majority of activity carried out by @value{tramp} requires only that
 the remote login is possible and is carried out at the terminal.  In
 order to access remote files @value{tramp} needs to transfer their content
@@ -266,9 +266,9 @@ to the local machine temporarily.
 The details are easy to select, depending on your needs and the
 machines in question.
 
-The fastest transfer methods (for large files) rely on a remote file
-transfer package such as @command{rcp}, @command{scp} or
-@command{rsync}.
+The fastest transfer methods for large files rely on a remote file
+transfer package such as @command{rcp}, @command{scp}, @command{rsync}
+or (under Windows) @command{pscp}.
 
 If the remote copy methods are not suitable for you, @value{tramp} also
 supports the use of encoded transfers directly through the shell.
@@ -276,15 +276,6 @@ This requires that the @command{mimencode} or @command{uuencode} tools
 are available on the remote machine.  These methods are generally
 faster for small files.
 
-Within these limitations, @value{tramp} is quite powerful.  It is worth
-noting that, as of the time of writing, it is far from a polished
-end-user product.  For a while yet you should expect to run into rough
-edges and problems with the code now and then.
-
-It is finished enough that the developers use it for day to day work but
-the installation and setup can be a little difficult to master, as can
-the terminology.
-
 @value{tramp} is still under active development and any problems you encounter,
 trivial or major, should be reported to the @value{tramp} developers.
 @xref{Bug Reports}.
@@ -330,9 +321,10 @@ host, followed by a newline.
 @value{tramp} now waits for the shell prompt or for a message that the login
 failed.
 
-If @value{tramp} sees neither of them after a certain period of time (a minute,
-say), then it issues an error message saying that it couldn't find the
-remote shell prompt and shows you what the remote host has sent.
+If @value{tramp} sees neither of them after a certain period of time
+(a minute, say), then it issues an error message saying that it
+couldn't find the remote shell prompt and shows you what the remote
+host has sent.
 
 If @value{tramp} sees a @samp{login failed} message, it tells you so,
 aborts the login attempt and allows you to try again.
@@ -373,7 +365,8 @@ For inline transfers, @value{tramp} issues a command like @samp{mimencode -b
 buffer that's used for communication, then decodes that output to
 produce the file contents.
 
-For out-of-band transfers, @value{tramp} issues a command like the following:
+For external transfers, @value{tramp} issues a command like the
+following:
 @example
 rcp user@@host:/path/to/remote/file /tmp/tramp.4711
 @end example
@@ -386,9 +379,9 @@ behind the scenes.  (Unless you have read this section, that is.)  When
 you are finished, you type @kbd{C-x C-s} to save the buffer.
 
 @item
-Again, @value{tramp} transfers the file contents to the remote host either
-inline or out-of-band.  This is the reverse of what happens when reading
-the file.
+Again, @value{tramp} transfers the file contents to the remote host
+either inline or external.  This is the reverse of what happens when
+reading the file.
 @end itemize
 
 I hope this has provided you with a basic overview of what happens
@@ -520,7 +513,7 @@ Method}.
 @menu
 * Connection types::            Types of connections made to remote machines.
 * Inline methods::              Inline methods.
-* External transfer methods::   External transfer methods.
+* External methods::            External methods.
 @ifset emacsgw
 * Gateway methods::             Gateway methods.
 @end ifset
@@ -533,7 +526,7 @@ Method}.
 * Multi-hops::                  Connecting to a remote host using multiple hops.
 * Customizing Methods::         Using Non-Standard Methods.
 * Customizing Completion::      Selecting config files for user/host name completion.
-* Password caching::            Reusing passwords for several connections.
+* Password handling::           Reusing passwords for several connections.
 * Connection caching::          Reusing connection related information.
 * Remote Programs::             How @value{tramp} finds and uses programs on the remote machine.
 * Remote shell setup::          Remote shell setup hints.
@@ -557,36 +550,30 @@ the local machine.  It is only when visiting files that the methods
 differ.
 
 @cindex inline methods
-@cindex external transfer methods
 @cindex external methods
-@cindex out-of-band methods
 @cindex methods, inline
-@cindex methods, external transfer
-@cindex methods, out-of-band
+@cindex methods, external
 Loading or saving a remote file requires that the content of the file
-be transfered between the two machines.  The content of the file can be
-transfered over the same connection used to log in to the remote
-machine or the file can be transfered through another connection using
-a remote copy program such as @command{rcp}, @command{scp} or
-@command{rsync}.  The former are called @dfn{inline methods}, the
-latter are called @dfn{out-of-band methods} or @dfn{external transfer
-methods} (@dfn{external methods} for short).
-
-The performance of the external transfer methods is generally better
-than that of the inline methods, at least for large files.  This is
-caused by the need to encode and decode the data when transferring
-inline.
+be transfered between the two machines.  The content of the file can
+be transfered using one of two methods: the @dfn{inline method} over
+the same connection used to log in to the remote machine, or the
+@dfn{external method} through another connection using a remote copy
+program such as @command{rcp}, @command{scp} or @command{rsync}.
+
+The performance of the external methods is generally better than that
+of the inline methods, at least for large files.  This is caused by
+the need to encode and decode the data when transferring inline.
 
 The one exception to this rule are the @command{scp} based transfer
 methods.  While these methods do see better performance when actually
 transferring files, the overhead of the cryptographic negotiation at
 startup may drown out the improvement in file transfer times.
 
-External transfer methods should be configured such a way that they
-don't require a password (with @command{ssh-agent}, or such alike).
-Modern @command{scp} implementations offer options to reuse existing
+External methods should be configured such a way that they don't
+require a password (with @command{ssh-agent}, or such alike).  Modern
+@command{scp} implementations offer options to reuse existing
 @command{ssh} connections, see method @command{scpc}.  If it isn't
-possible, you should consider @ref{Password caching}, otherwise you
+possible, you should consider @ref{Password handling}, otherwise you
 will be prompted for a password every copy action.
 
 
@@ -674,8 +661,10 @@ as the @option{rsh} method.
 
 This method does not connect to a remote host at all, rather it uses
 the @command{su} program to allow you to edit files as another user.
-With other words, a specified host name in the file name is silently
-ignored.
+That means, the specified host name in the file name must be either
+@samp{localhost} or the host name as returned by the function
+@command{(system-name)}.  For an exception of this rule see
+@ref{Multi-hops}.
 
 
 @item @option{sudo}
@@ -777,24 +766,22 @@ maybe somebody can improve the performance.
 @end table
 
 
-@node External transfer methods
-@section External transfer methods
-@cindex methods, external transfer
-@cindex methods, out-of-band
-@cindex external transfer methods
-@cindex out-of-band methods
+@node External methods
+@section External methods
+@cindex methods, external
+@cindex external methods
 
-The external transfer methods operate through multiple channels, using
-the remote shell connection for many actions while delegating file
+The external methods operate through multiple channels, using the
+remote shell connection for many actions while delegating file
 transfers to an external transfer utility.
 
 This saves the overhead of encoding and decoding that multiplexing the
 transfer through the one connection has with the inline methods.
 
-Since external transfer methods need their own overhead opening a new
-channel, all files which are smaller than @var{tramp-copy-size-limit}
-are still transferred with the corresponding inline method.  It should
-provide a fair trade-off between both approaches.
+Since external methods need their own overhead opening a new channel,
+all files which are smaller than @var{tramp-copy-size-limit} are still
+transferred with the corresponding inline method.  It should provide a
+fair trade-off between both approaches.
 
 @table @asis
 @item @option{rcp}  ---  @command{rsh} and @command{rcp}
@@ -1014,7 +1001,7 @@ directory @code{/}), all available shares are listed.
 
 Since authorization is done on share level, you will be prompted
 always for a password if you access another share on the same host.
-This can be suppressed by @ref{Password caching}.
+This can be suppressed by @ref{Password handling}.
 
 MS Windows uses for authorization both a user name and a domain name.
 Because of this, the @value{tramp} syntax has been extended: you can
@@ -1133,11 +1120,11 @@ the machine @samp{localhost}.
 See the documentation for the variable
 @code{tramp-default-method-alist} for more details.
 
-External transfer methods are normally preferable to inline transfer
-methods, giving better performance.
+External methods are normally preferable to inline methods, giving
+better performance.
 
 @xref{Inline methods}.
-@xref{External transfer methods}.
+@xref{External methods}.
 
 Another consideration with the selection of transfer methods is the
 environment you will use them in and, especially when used over the
@@ -1165,9 +1152,9 @@ maximum freedom instead.  However, the reality is that some users would
 like to have some guidance, so here I'll try to give you this guidance
 without bossing you around.  You tell me whether it works @dots{}
 
-My suggestion is to use an inline method.  For large files, out-of-band
-methods might be more efficient, but I guess that most people will want
-to edit mostly small files.
+My suggestion is to use an inline method.  For large files, external
+methods might be more efficient, but I guess that most people will
+want to edit mostly small files.
 
 I guess that these days, most people can access a remote machine by
 using @command{ssh}.  So I suggest that you use the @option{ssh}
@@ -1188,10 +1175,10 @@ shortened syntax for the @samp{root} account, like
 
 People who edit large files may want to consider @option{scpc} instead
 of @option{ssh}, or @option{pscp} instead of @option{plink}.  These
-out-of-band methods are faster than inline methods for large files.
-Note, however, that out-of-band methods suffer from some limitations.
+external methods are faster than inline methods for large files.
+Note, however, that external methods suffer from some limitations.
 Please try first whether you really get a noticeable speed advantage
-from using an out-of-band method!  Maybe even for large files, inline
+from using an external method!  Maybe even for large files, inline
 methods are fast enough.
 
 
@@ -1527,7 +1514,7 @@ Example:
 @end defun
 
 
-@node Password caching
+@node Password handling
 @section Reusing passwords for several connections.
 @cindex passwords
 
@@ -1536,9 +1523,43 @@ times.  Reentering passwords again and again would be annoying, when
 the chosen method does not support access without password prompt
 through own configuration.
 
-By default, @value{tramp} caches the passwords entered by you.  They will
-be reused next time if a connection needs them for the same user name
-and host name, independently of the connection method.
+The best recommendation is to use the method's own mechanism for
+password handling. Consider @command{ssh-agent} for @option{ssh}-like
+methods, or @command{pageant} for @option{plink}-like methods.
+
+However, if you cannot apply such native password handling,
+@value{tramp} offers altenatives.
+
+
+@anchor{auth-sources}
+@subsection Using an authentication file
+
+@vindex auth-sources
+The package @file{auth-source.el}, originally developed in No Gnus,
+offers the possibility to read passwords from a file, like FTP does it
+from @file{~/.netrc}.  The default authentication file is
+@file{~/.authinfo.gpg}, this can be changed via the variable
+@code{auth-sources}.
+
+@noindent
+A typical entry in the authentication file would be
+
+@example
+machine melancholia port scp login daniel password geheim
+@end example
+
+The port can be any @value{tramp} method (@pxref{Inline methods},
+@pxref{External methods}), to match only this method.  When you omit
+the port, you match all @value{tramp} methods.
+
+
+@anchor{password-cache}
+@subsection Caching passwords
+
+If there is no authentication file, @value{tramp} caches the passwords
+entered by you.  They will be reused next time if a connection needs
+them for the same user name and host name, independently of the
+connection method.
 
 @vindex password-cache-expiry
 Passwords are not saved permanently, that means the password caching
@@ -1548,28 +1569,20 @@ variable @code{password-cache-expiry}.  The value is the number of
 seconds how long passwords are cached.  Setting it to @code{nil}
 disables the expiration.
 
-@findex tramp-clear-passwd
-A password is removed from the cache if a connection isn't established
-successfully.  You can remove a password from the cache also by
-executing @kbd{M-x tramp-clear-passwd} in a buffer containing a
-related remote file or directory.
-
 @vindex password-cache
 If you don't like this feature for security reasons, password caching
 can be disabled totally by customizing the variable
 @code{password-cache} (setting it to @code{nil}).
 
 Implementation Note: password caching is based on the package
-@file{password.el} in No Gnus.  For the time being, it is activated
-only when this package is seen in the @code{load-path} while loading
+@file{password-cache.el}.  For the time being, it is activated only
+when this package is seen in the @code{load-path} while loading
 @value{tramp}.
 @ifset installchapter
 If you don't use No Gnus, you can take @file{password.el} from the
 @value{tramp} @file{contrib} directory, see @ref{Installation
 parameters}.
 @end ifset
-It will be activated mandatory once No Gnus has found its way into
-@value{emacsname}.
 
 
 @node Connection caching
@@ -1597,6 +1610,25 @@ exiting @value{emacsname}.  You can simply remove this file if
 Using such persistent information can be disabled by setting
 @code{tramp-persistency-file-name} to @code{nil}.
 
+Once consequence of reusing connection related information is that
+@var{tramp} needs to distinguish hosts.  If you, for example, run a
+local @code{sshd} on port 3001, which tunnels @command{ssh} to another
+host, you could access both @file{@trampfn{ssh, , localhost,}} and
+@file{@trampfn{ssh, , localhost#3001,}}.  @var{tramp} would use the
+same host related information (like paths, Perl variants, etc) for
+both connections, although the information is valid only for one of
+them.
+
+In order to avoid trouble, you must use another host name for one of
+the connections, like introducing a @option{Host} section in
+@file{~/.ssh/config} (@pxref{Frequently Asked Questions}) or applying
+multiple hops (@pxref{Multi-hops}).
+
+When @value{tramp} detects a changed operating system version on a
+remote host (via the command @command{uname -sr}), it flushes all
+connection related information for this host, and opens the
+connection, again.
+
 
 @node Remote Programs
 @section How @value{tramp} finds and uses programs on the remote machine.
@@ -1607,7 +1639,7 @@ function, including @command{ls}, @command{test}, @command{find} and
 
 In addition to these required tools, there are various tools that may be
 required based on the connection method.  See @ref{Inline methods} and
-@ref{External transfer methods} for details on these.
+@ref{External methods} for details on these.
 
 Certain other tools, such as @command{perl} (or @command{perl5}) and
 @command{grep} will be used if they can be found.  When they are
@@ -1654,7 +1686,6 @@ you must exit @value{emacsname}, remove your persistency file
 
 
 @node Remote shell setup
-@comment  node-name,  next,  previous,  up
 @section Remote shell setup hints
 @cindex remote shell setup
 @cindex @file{.profile} file
@@ -1719,6 +1750,39 @@ different user.  The default value of
 @code{shell-prompt-pattern}, which is reported to work well in many
 circumstances.
 
+@item @var{tramp-password-prompt-regexp}
+@vindex tramp-password-prompt-regexp
+@vindex tramp-wrong-passwd-regexp
+
+During login, @value{tramp} might be forced to enter a password or a
+passphrase.  The difference between both is that a password is
+requested from the shell on the remote host, while a passphrase is
+needed for accessing local authentication information, like your ssh
+key.
+
+@var{tramp-password-prompt-regexp} handles the detection of such
+requests for English environments.  When you use another localization
+of your (local or remote) host, you might need to adapt this. Example:
+
+@lisp
+(setq
+  tramp-password-prompt-regexp
+    (concat
+      "^.*"
+      (regexp-opt
+        '("passphrase" "Passphrase"
+          ;; English
+          "password" "Password"
+          ;; Deutsch
+          "passwort" "Passwort"
+          ;; Fran@,{c}ais
+          "mot de passe" "Mot de passe") t)
+      ".*:\0? *"))
+@end lisp
+
+In parallel, it might also be necessary to adapt
+@var{tramp-wrong-passwd-regexp}.
+
 @item @command{tset} and other questions
 @cindex Unix command tset
 @cindex tset Unix command
@@ -2030,6 +2094,7 @@ minute you have already forgotten that you hit that key!
 * Alternative Syntax::          URL-like filename syntax.
 * Filename completion::         Filename completion.
 * Remote processes::            Integration with other @value{emacsname} packages.
+* Cleanup remote connections::  Cleanup remote connections.
 @end menu
 
 
@@ -2070,6 +2135,14 @@ This edits the file @file{/etc/squid.conf} on the machine
 
 @end table
 
+@var{machine} can also be an IPv4 or IPv6 address, like in
+@file{@trampfn{, , 127.0.0.1, .emacs}} or @file{@trampfn{, ,
+@value{ipv6prefix}::1@value{ipv6postfix}, .emacs}}.
+@ifset emacs
+For syntactical reasons, IPv6 addresses must be embedded in square
+brackets @file{@value{ipv6prefix}} and @file{@value{ipv6postfix}}.
+@end ifset
+
 Unless you specify a different name to use, @value{tramp} will use the
 current local user name as the remote user name to log in with.  If you
 need to log in as a different user, you can specify the user name as
@@ -2082,8 +2155,8 @@ connecting to @code{melancholia} as @code{daniel} and editing
 @file{@trampfn{, daniel, melancholia, .emacs}}.
 
 It is also possible to specify other file transfer methods
-(@pxref{Inline methods}, @pxref{External transfer methods}) as part of
-the filename.
+(@pxref{Inline methods}, @pxref{External methods}) as part of the
+filename.
 @ifset emacs
 This is done by putting the method before the user and host name, as
 in @file{@value{prefix}@var{method}@value{postfixhop}} (Note the
@@ -2150,17 +2223,7 @@ Filename completion works with @value{tramp} for completion of method
 names, of user names and of machine names as well as for completion of
 file names on remote machines.
 @ifset emacs
-In order to enable this, Partial Completion mode must be set
-on@footnote{If you don't use Partial Completion mode, but want to
-keep full completion, load @value{tramp} like this in your
-@file{.emacs}:
-
-@lisp
-;; Preserve Tramp's completion features.
-(let ((partial-completion-mode t))
-  (require 'tramp))
-@end lisp
-}.
+In order to enable this, Partial Completion mode must be set on.
 @ifinfo
 @xref{Completion Options, , , @value{emacsdir}}.
 @end ifinfo
@@ -2170,13 +2233,15 @@ If you, for example, type @kbd{C-x C-f @value{prefix}t
 @key{TAB}}, @value{tramp} might give you as result the choice for
 
 @example
+@multitable {@trampfn{telnet, , melancholia.danann.net,}} {@trampfn{telnet, , 192.168.0.1,}}
 @ifset emacs
-@value{prefixhop}telnet@value{postfixhop}                        tmp/
-@value{prefixhop}toto@value{postfix}
+@item @value{prefixhop}telnet@value{postfixhop} @tab tmp/
+@item @value{prefixhop}toto@value{postfix} @tab
 @end ifset
 @ifset xemacs
-@value{prefixhop}telnet@value{postfixhop}                        @value{prefixhop}toto@value{postfix}
+@item @value{prefixhop}telnet@value{postfixhop} @tab @value{prefixhop}toto@value{postfix}
 @end ifset
+@end multitable
 @end example
 
 @samp{@value{prefixhop}telnet@value{postfixhop}}
@@ -2195,9 +2260,11 @@ Next @kbd{@key{TAB}} brings you all machine names @value{tramp} detects in
 your @file{/etc/hosts} file, let's say
 
 @example
-@trampfn{telnet, , 127.0.0.1,}             @trampfn{telnet, , 192.168.0.1,}
-@trampfn{telnet, , localhost,}             @trampfn{telnet, , melancholia.danann.net,}
-@trampfn{telnet, , melancholia,}
+@multitable {@trampfn{telnet, , melancholia.danann.net,}} {@trampfn{telnet, , 192.168.0.1,}}
+@item @trampfn{telnet, , 127.0.0.1,} @tab @trampfn{telnet, , 192.168.0.1,}
+@item @trampfn{telnet, , @value{ipv6prefix}::1@value{ipv6postfix},} @tab @trampfn{telnet, , localhost,}
+@item @trampfn{telnet, , melancholia.danann.net,} @tab @trampfn{telnet, , melancholia,}
+@end multitable
 @end example
 
 Now you can choose the desired machine, and you can continue to
@@ -2215,27 +2282,49 @@ filename completion on the remote host.  This works pretty much like
 for files on the local host, with the exception that minibuffer
 killing via a double-slash works only on the filename part, except
 that filename part starts with @file{//}.
+@ifset emacs
+A triple-slash stands for the default behavior.
+@end ifset
 @ifinfo
 @xref{Minibuffer File, , , @value{emacsdir}}.
 @end ifinfo
 
+@noindent
+Example:
+
+@example
 @ifset emacs
-As example, @kbd{@trampfn{telnet, , melancholia, /usr/local/bin//etc}
-@key{TAB}} would result in
-@file{@trampfn{telnet, , melancholia, /etc}}, whereas
-@kbd{@trampfn{telnet, , melancholia, //etc} @key{TAB}} reduces the
-minibuffer contents to @file{/etc}.  A triple-slash stands for the
-default behaviour,
-i.e. @kbd{@trampfn{telnet, , melancholia, /usr/local/bin///etc}
-@key{TAB}} expands directly to @file{/etc}.
+@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//etc} @key{TAB}}
+     @print{} @trampfn{telnet, , melancholia, /etc}
+
+@kbd{C-x C-f @trampfn{telnet, , melancholia, //etc} @key{TAB}}
+     @print{} /etc
+
+@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin///etc} @key{TAB}}
+     @print{} /etc
 @end ifset
 
 @ifset xemacs
-As example, @kbd{@trampfn{telnet, , melancholia, /usr/local/bin//}}
-would result in @file{@trampfn{telnet, , melancholia, /}}, whereas
-@kbd{@trampfn{telnet, , melancholia, //}} expands the minibuffer
-contents to @file{/}.
+@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//}}
+     @print{} @trampfn{telnet, , melancholia, /}
+
+@kbd{C-x C-f @trampfn{telnet, , melancholia, //}}
+     @print{} /
 @end ifset
+@end example
+
+A remote directory might have changed its contents out of
+@value{emacsname} control, for example by creation or deletion of
+files by other processes.  Therefore, during filename completion the
+remote directory contents is reread regularly in order to detect such
+changes, which would be invisible otherwise (@pxref{Connection caching}).
+
+@defopt tramp-completion-reread-directory-timeout
+This variable defines the number of seconds since last remote command
+before rereading a directory contents.  A value of 0 would require an
+immediate reread during filename completion, @code{nil} means to use
+always cached values for the directory contents.
+@end defopt
 
 
 @node Remote processes
@@ -2297,6 +2386,22 @@ out-of-the-box on a remote host, please let us know.  We will try to
 integrate them as well.  @xref{Bug Reports}.
 
 
+@subsection Running shell-command on a remote host
+@cindex shell-command
+
+@code{shell-command} allows to execute commands in a shell, either
+synchronously, either asynchronously.  This works also on remote
+hosts.  Example:
+
+@example
+@kbd{C-x C-f @trampfn{sudo, , , } @key{RET}}
+@kbd{M-! tail -f /var/log/syslog.log & @key{RET}}
+@end example
+
+You will see the buffer @file{*Async Shell Command*}, containing the
+continous output of the @command{tail} command.
+
+
 @subsection Running eshell on a remote host
 @cindex eshell
 
@@ -2352,10 +2457,39 @@ file name as program to debug, like @kbd{perl -d
 /home/user/myprog.pl}, though.
 
 Arguments of the program to be debugged are taken literally.  That
-means file names as arguments must be given as ordinary relative or
+means, file names as arguments must be given as ordinary relative or
 absolute file names, without any remote specification.
 
 
+@node Cleanup remote connections
+@section Cleanup remote connections.
+@cindex cleanup
+
+Sometimes it is useful to cleanup remote connections.  The following
+commands support this.
+
+@deffn Command tramp-cleanup-connection vec
+This command flushes all connection related objects.  @option{vec} is
+the internal representation of a remote connection.  Called
+interactively, the command offers all active remote connections in the
+minibuffer as remote file name prefix like @file{@trampfn{method,
+user, host, }}.  The cleanup includes password cache (@pxref{Password
+handling}), file cache, connection cache (@pxref{Connection caching}),
+connection buffers.
+@end deffn
+
+@deffn Command tramp-cleanup-all-connections
+This command flushes objects for all active remote connections.  The
+same objects are removed as in @code{tramp-cleanup-connection}.
+@end deffn
+
+@deffn Command tramp-cleanup-all-buffers
+Like in @code{tramp-cleanup-all-connections}, all remote connections
+are cleaned up.  Additionally all buffers, which are related to a
+remote connection, are killed.
+@end deffn
+
+
 @node Bug Reports
 @chapter Reporting Bugs and Problems
 @cindex bug reports
@@ -2379,6 +2513,7 @@ Subscribing to the list is performed via
 @uref{http://lists.gnu.org/mailman/listinfo/tramp-devel/,
 the @value{tramp} Mail Subscription Page}.
 
+@findex tramp-bug
 To report a bug in @value{tramp}, you should execute @kbd{M-x
 tramp-bug}.  This will automatically generate a buffer with the details
 of your system and @value{tramp} version.
@@ -2458,7 +2593,7 @@ host as well as the time needed to perform the operations there count.
 In order to speed up @value{tramp}, one could either try to avoid some
 of the operations, or one could try to improve their performance.
 
-Use an external transfer method, like @option{scpc}.
+Use an external method, like @option{scpc}.
 
 Use caching.  This is already enabled by default.  Information about
 the remote host as well as the remote files are cached for reuse.  The
@@ -2504,7 +2639,7 @@ setting the cursor at the top of the buffer, and applying the expression
 @end example
 
 If it fails, or the cursor is not moved at the end of the buffer, your
-prompt is not recognised correctly.
+prompt is not recognized correctly.
 
 A special problem is the zsh, which uses left-hand side and right-hand
 side prompts in parallel.  Therefore, it is necessary to disable the
@@ -2591,24 +2726,45 @@ remote host.
 @lisp
 (defadvice tramp-handle-write-region
   (after tramp-write-beep-advice activate)
" make tramp beep after writing a file."
- (interactive)
- (beep))
 "Make tramp beep after writing a file."
 (interactive)
 (beep))
 
 (defadvice tramp-handle-do-copy-or-rename-file
   (after tramp-copy-beep-advice activate)
" make tramp beep after copying a file."
- (interactive)
- (beep))
 "Make tramp beep after copying a file."
 (interactive)
 (beep))
 
 (defadvice tramp-handle-insert-file-contents
-  (after tramp-copy-beep-advice activate)
" make tramp beep after copying a file."
- (interactive)
- (beep))
+  (after tramp-insert-beep-advice activate)
 "Make tramp beep after inserting a file."
 (interactive)
 (beep))
 @end lisp
 
 
+@ifset emacs
+@item
+I'ld like to get a Visual Warning when working in a sudo:ed context
+
+When you are working with @samp{root} privileges, it might be useful
+to get an indication in the buffer's modeline.  The following code,
+tested with @value{emacsname} 22.1, does the job.  You should put it
+into your @file{~/.emacs}:
+
+@lisp
+(defun my-mode-line-function ()
+  (when (string-match "^/su\\(do\\)?:" default-directory)
+    (setq mode-line-format
+          (format-mode-line mode-line-format 'font-lock-warning-face))))
+
+(add-hook 'find-file-hooks 'my-mode-line-function)
+(add-hook 'dired-mode-hook 'my-mode-line-function)
+@end lisp
+@end ifset
+
+
 @ifset emacs
 @item
 I'ld like to see a host indication in the mode line when I'm remote
@@ -2740,7 +2896,7 @@ Host xy
 
 The file name left to type would be @kbd{C-x C-f @trampfn{ssh, , xy,
 /opt/news/etc}}.  Depending on files in your directories, it is even
-possible to complete the hostname with @kbd{C-x C-f
+possible to complete the host name with @kbd{C-x C-f
 @value{prefix}ssh@value{postfixhop}x @key{TAB}}.
 
 @item Use environment variables:
@@ -2952,6 +3108,9 @@ How can I disable @value{tramp}?
 
 Shame on you, why did you read until now?
 
+@itemize @minus
+
+@item
 @ifset emacs
 If you just want to have @value{ftppackagename} as default remote
 files access package, you should apply the following code:
@@ -2961,12 +3120,28 @@ files access package, you should apply the following code:
 @end lisp
 @end ifset
 
+@item
+In order to disable
+@ifset emacs
+@value{tramp} (and @value{ftppackagename}),
+@end ifset
+@ifset xemacs
+@value{tramp},
+@end ifset
+you must set @code{tramp-mode} to @code{nil}:
+
+@lisp
+(setq tramp-mode nil)
+@end lisp
+
+@item
 Unloading @value{tramp} can be achieved by applying @kbd{M-x
 tramp-unload-tramp}.
 @ifset emacs
 This resets also the @value{ftppackagename} plugins.
 @end ifset
 @end itemize
+@end itemize
 
 
 @c For the developer
@@ -3228,9 +3403,8 @@ function call traces.  Such traces are enabled by the following code:
 @lisp
 (require 'tramp)
 (require 'trace)
-(mapcar 'trace-function-background
-        (mapcar 'intern
-                (all-completions "tramp-" obarray 'functionp)))
+(dolist (elt (all-completions "tramp-" obarray 'functionp))
+  (trace-function-background (intern elt)))
 (untrace-function 'tramp-read-passwd)
 (untrace-function 'tramp-gw-basic-authentication)
 @end lisp
@@ -3304,10 +3478,18 @@ for @value{emacsothername}.
 @appendix GNU Free Documentation License
 @include doclicense.texi
 
+@node Function Index
+@unnumbered Function Index
+@printindex fn
+
+@node Variable Index
+@unnumbered Variable Index
+@printindex vr
+
 @node Concept Index
-@comment node-name,    next,  previous,      up
 @unnumbered Concept Index
 @printindex cp
+
 @contents
 @c End of tramp.texi - the TRAMP User Manual
 @bye
@@ -3318,13 +3500,9 @@ for @value{emacsothername}.
 @c   shells.
 @c * Explain how tramp.el works in principle: open a shell on a remote
 @c   host and then send commands to it.
-@c * Make terminology "inline" vs "out-of-band" consistent.
-@c   It seems that "external" is also used instead of "out-of-band".
-
-@c * M. Albinus
-@c ** Use `filename' resp. `file name' consistently.
-@c ** Use `host' resp. `machine' consistently.
-@c ** Consistent small or capitalized words especially in menues.
+@c * Use `filename' resp. `file name' consistently.
+@c * Use `host' resp. `machine' consistently.
+@c * Consistent small or capitalized words especially in menues.
 
 @ignore
    arch-tag: f96dd66e-6dd3-4c92-8d77-9c56205ba808