Fix minor whitespace issues after "." in manual.
[bpt/emacs.git] / doc / misc / tramp.texi
CommitLineData
4009494e 1\input texinfo @c -*-texinfo-*-
db78a8cb 2@setfilename ../../info/tramp
4009494e
GM
3@c %**start of header
4@settitle TRAMP User Manual
4009494e
GM
5@c %**end of header
6
7@c This is *so* much nicer :)
8@footnotestyle end
9
328dac0d 10@c In the Tramp repository, the version number is auto-frobbed from
4009494e
GM
11@c configure.ac, so you should edit that file and run
12@c "autoconf && ./configure" to change the version number.
13
14@c Additionally, flags are set with respect to the Emacs flavor; and
15@c depending whether Tramp is packaged into (X)Emacs, or standalone.
16
17@include trampver.texi
18
31ae5827 19@c Macro for formatting a filename according to the respective syntax.
4009494e
GM
20@c xxx and yyy are auxiliary macros in order to omit leading and
21@c trailing whitespace. Not very elegant, but I don't know it better.
22
23@macro xxx {one}@c
24@set \one\@c
25@end macro
26
27@macro yyy {one, two}@c
28@xxx{x\one\}@c
29@ifclear x@c
30\one\@w{}\two\@c
31@end ifclear
32@clear x\one\@c
33@end macro
34
35@macro trampfn {method, user, host, localname}@c
36@value{prefix}@yyy{\method\,@value{postfixhop}}@yyy{\user\,@@}\host\@value{postfix}\localname\@c
37@end macro
38
39@copying
acaf905b 40Copyright @copyright{} 1999-2012 Free Software Foundation, Inc.
4009494e
GM
41
42@quotation
43Permission is granted to copy, distribute and/or modify this document
6a2c4aec 44under the terms of the GNU Free Documentation License, Version 1.3 or
4009494e 45any later version published by the Free Software Foundation; with no
debf4439
GM
46Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
47and with the Back-Cover Texts as in (a) below. A copy of the license
48is included in the section entitled ``GNU Free Documentation License''.
4009494e 49
7ed4a047
MA
50(a) The FSF's Back-Cover Text is: ``You have the freedom to
51copy and modify this GNU manual. Buying copies from the FSF
52supports it in developing GNU and promoting software freedom.''
4009494e
GM
53@end quotation
54@end copying
55
56@c Entries for @command{install-info} to use
0c973505 57@dircategory @value{emacsname} network features
4009494e 58@direntry
62e034c2
GM
59* TRAMP: (tramp). Transparent Remote Access, Multiple Protocol
60 @value{emacsname} remote file access via rsh and rcp.
4009494e
GM
61@end direntry
62
4009494e
GM
63@titlepage
64@title @value{tramp} version @value{trampver} User Manual
4009494e
GM
65@author by Daniel Pittman
66@author based on documentation by Kai Gro@ss{}johann
4009494e
GM
67@page
68@insertcopying
4009494e 69@end titlepage
4009494e 70
5dc584b5 71@contents
4009494e
GM
72
73@ifnottex
74@node Top, Overview, (dir), (dir)
75@top @value{tramp} version @value{trampver} User Manual
76
77This file documents @value{tramp} version @value{trampver}, a remote file
78editing package for @value{emacsname}.
79
80@value{tramp} stands for `Transparent Remote (file) Access, Multiple
81Protocol'. This package provides remote file editing, similar to
82@value{ftppackagename}.
83
84The difference is that @value{ftppackagename} uses FTP to transfer
85files between the local and the remote host, whereas @value{tramp} uses a
86combination of @command{rsh} and @command{rcp} or other work-alike
87programs, such as @command{ssh}/@command{scp}.
88
89You can find the latest version of this document on the web at
90@uref{http://www.gnu.org/software/tramp/}.
91
92@c Pointer to the other Emacs flavor is necessary only in case of
93@c standalone installation.
94@ifset installchapter
95The manual has been generated for @value{emacsname}.
96@ifinfo
97If you want to read the info pages for @value{emacsothername}, you
98should read in @ref{Installation} how to create them.
99@end ifinfo
100@ifhtml
101If you're using the other Emacs flavor, you should read the
102@uref{@value{emacsotherfilename}, @value{emacsothername}} pages.
103@end ifhtml
104@end ifset
105
106@ifhtml
4009494e
GM
107The latest release of @value{tramp} is available for
108@uref{ftp://ftp.gnu.org/gnu/tramp/, download}, or you may see
328dac0d 109@ref{Obtaining Tramp} for more details, including the Git server
4009494e
GM
110details.
111
112@value{tramp} also has a @uref{http://savannah.gnu.org/projects/tramp/,
113Savannah Project Page}.
114@end ifhtml
115
116There is a mailing list for @value{tramp}, available at
117@email{tramp-devel@@gnu.org}, and archived at
118@uref{http://lists.gnu.org/archive/html/tramp-devel/, the
119@value{tramp} Mail Archive}.
120@ifhtml
121Older archives are located at
122@uref{http://sourceforge.net/mailarchive/forum.php?forum=tramp-devel,
123SourceForge Mail Archive} and
124@uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/,
125The Mail Archive}.
126@c in HTML output, there's no new paragraph.
127@*@*
128@end ifhtml
129
130@insertcopying
131
132@end ifnottex
133
134@menu
135* Overview:: What @value{tramp} can and cannot do.
136
137For the end user:
138
139* Obtaining Tramp:: How to obtain @value{tramp}.
140* History:: History of @value{tramp}.
141@ifset installchapter
142* Installation:: Installing @value{tramp} with your @value{emacsname}.
143@end ifset
144* Configuration:: Configuring @value{tramp} for use.
145* Usage:: An overview of the operation of @value{tramp}.
146* Bug Reports:: Reporting Bugs and Problems.
147* Frequently Asked Questions:: Questions and answers from the mailing list.
dd753688
MA
148* Function Index:: @value{tramp} functions.
149* Variable Index:: User options and variables.
4009494e
GM
150* Concept Index:: An item for each concept.
151
152For the developer:
153
4009494e
GM
154* Files directories and localnames:: How file names, directories and localnames are mangled and managed.
155* Traces and Profiles:: How to Customize Traces.
156* Issues:: Debatable Issues and What Was Decided.
157
158* GNU Free Documentation License:: The license for this documentation.
159
160@detailmenu
161 --- The Detailed Node Listing ---
162@c
163@ifset installchapter
164Installing @value{tramp} with your @value{emacsname}
165
166* Installation parameters:: Parameters in order to control installation.
167* Load paths:: How to plug-in @value{tramp} into your environment.
4009494e
GM
168
169@end ifset
170
171Configuring @value{tramp} for use
172
173* Connection types:: Types of connections made to remote machines.
174* Inline methods:: Inline methods.
193e6828 175* External methods:: External methods.
88a683c5
MA
176@ifset emacsgvfs
177* GVFS based methods:: GVFS based external methods.
178@end ifset
4009494e
GM
179@ifset emacsgw
180* Gateway methods:: Gateway methods.
181@end ifset
182* Default Method:: Selecting a default method.
183* Default User:: Selecting a default user.
184* Default Host:: Selecting a default host.
185* Multi-hops:: Connecting to a remote host using multiple hops.
186* Customizing Methods:: Using Non-Standard Methods.
187* Customizing Completion:: Selecting config files for user/host name completion.
a06a4a12 188* Password handling:: Reusing passwords for several connections.
4009494e
GM
189* Connection caching:: Reusing connection related information.
190* Remote Programs:: How @value{tramp} finds and uses programs on the remote machine.
191* Remote shell setup:: Remote shell setup hints.
192* Windows setup hints:: Issues with Cygwin ssh.
193* Auto-save and Backup:: Auto-save and Backup.
194
195Using @value{tramp}
196
197* Filename Syntax:: @value{tramp} filename conventions.
198* Alternative Syntax:: URL-like filename syntax.
199* Filename completion:: Filename completion.
888a7fc0 200* Ad-hoc multi-hops:: Declaring multiple hops in the file name.
4009494e 201* Remote processes:: Integration with other @value{emacsname} packages.
dd753688 202* Cleanup remote connections:: Cleanup remote connections.
4009494e 203
4009494e
GM
204How file names, directories and localnames are mangled and managed
205
206* Localname deconstruction:: Breaking a localname into its components.
ea3fc256
MA
207@ifset emacs
208* External packages:: Integration with external Lisp packages.
209@end ifset
4009494e
GM
210
211@end detailmenu
212@end menu
213
214@node Overview
215@chapter An overview of @value{tramp}
216@cindex overview
217
218After the installation of @value{tramp} into your @value{emacsname}, you
219will be able to access files on remote machines as though they were
220local. Access to the remote file system for editing files, version
221control, and @code{dired} are transparently enabled.
222
223Your access to the remote machine can be with the @command{rsh},
224@command{rlogin}, @command{telnet} programs or with any similar
225connection method. This connection must pass @acronym{ASCII}
226successfully to be usable but need not be 8-bit clean.
227
228The package provides support for @command{ssh} connections out of the
229box, one of the more common uses of the package. This allows
230relatively secure access to machines, especially if @command{ftp}
231access is disabled.
232
e1176b47
MA
233Under Windows, @value{tramp} is integrated with the PuTTY package,
234using the @command{plink} program.
235
4009494e
GM
236The majority of activity carried out by @value{tramp} requires only that
237the remote login is possible and is carried out at the terminal. In
238order to access remote files @value{tramp} needs to transfer their content
239to the local machine temporarily.
240
241@value{tramp} can transfer files between the machines in a variety of ways.
242The details are easy to select, depending on your needs and the
243machines in question.
244
e1176b47
MA
245The fastest transfer methods for large files rely on a remote file
246transfer package such as @command{rcp}, @command{scp}, @command{rsync}
247or (under Windows) @command{pscp}.
4009494e
GM
248
249If the remote copy methods are not suitable for you, @value{tramp} also
250supports the use of encoded transfers directly through the shell.
251This requires that the @command{mimencode} or @command{uuencode} tools
252are available on the remote machine. These methods are generally
253faster for small files.
254
4009494e
GM
255@value{tramp} is still under active development and any problems you encounter,
256trivial or major, should be reported to the @value{tramp} developers.
257@xref{Bug Reports}.
258
259
260@subsubheading Behind the scenes
261@cindex behind the scenes
262@cindex details of operation
263@cindex how it works
264
265This section tries to explain what goes on behind the scenes when you
266access a remote file through @value{tramp}.
267
268Suppose you type @kbd{C-x C-f} and enter part of an @value{tramp} file name,
269then hit @kbd{@key{TAB}} for completion. Suppose further that this is
270the first time that @value{tramp} is invoked for the host in question. Here's
271what happens:
272
273@itemize
274@item
275@value{tramp} discovers that it needs a connection to the host. So it
276invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
277@var{user}} or a similar tool to connect to the remote host.
278Communication with this process happens through an
279@value{emacsname} buffer, that is, the output from the remote end
280goes into a buffer.
281
282@item
283The remote host may prompt for a login name (for @command{telnet}).
284The login name is given in the file name, so @value{tramp} sends the
285login name and a newline.
286
287@item
288The remote host may prompt for a password or pass phrase (for
289@command{rsh} or for @command{telnet} after sending the login name).
290@value{tramp} displays the prompt in the minibuffer, asking you for the
291password or pass phrase.
292
293You enter the password or pass phrase. @value{tramp} sends it to the remote
294host, followed by a newline.
295
296@item
297@value{tramp} now waits for the shell prompt or for a message that the login
298failed.
299
bc5300d3
MA
300If @value{tramp} sees neither of them after a certain period of time
301(a minute, say), then it issues an error message saying that it
302couldn't find the remote shell prompt and shows you what the remote
303host has sent.
4009494e
GM
304
305If @value{tramp} sees a @samp{login failed} message, it tells you so,
306aborts the login attempt and allows you to try again.
307
308@item
309Suppose that the login was successful and @value{tramp} sees the shell prompt
310from the remote host. Now @value{tramp} invokes @command{/bin/sh} because
311Bourne shells and C shells have different command
312syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
313shell doesn't recognize @samp{exec /bin/sh} as a valid command.
314Maybe you use the Scheme shell @command{scsh}@dots{}}
315
316After the Bourne shell has come up, @value{tramp} sends a few commands to
317ensure a good working environment. It turns off echoing, it sets the
318shell prompt, and a few other things.
319
320@item
321Now the remote shell is up and it good working order. Remember, what
322was supposed to happen is that @value{tramp} tries to find out what files exist
323on the remote host so that it can do filename completion.
324
325So, @value{tramp} basically issues @command{cd} and @command{ls} commands and
326also sometimes @command{echo} with globbing. Another command that is
327often used is @command{test} to find out whether a file is writable or a
328directory or the like. The output of each command is parsed for the
329necessary operation.
330
331@item
332Suppose you are finished with filename completion, have entered @kbd{C-x
333C-f}, a full file name and hit @kbd{@key{RET}}. Now comes the time to
334transfer the file contents from the remote host to the local host so
335that you can edit them.
336
337See above for an explanation of how @value{tramp} transfers the file contents.
338
339For inline transfers, @value{tramp} issues a command like @samp{mimencode -b
340/path/to/remote/file}, waits until the output has accumulated in the
341buffer that's used for communication, then decodes that output to
342produce the file contents.
343
193e6828
MA
344For external transfers, @value{tramp} issues a command like the
345following:
4009494e
GM
346@example
347rcp user@@host:/path/to/remote/file /tmp/tramp.4711
348@end example
349It then reads the local temporary file @file{/tmp/tramp.4711} into a
350buffer and deletes the temporary file.
351
352@item
353You now edit the buffer contents, blithely unaware of what has happened
354behind the scenes. (Unless you have read this section, that is.) When
355you are finished, you type @kbd{C-x C-s} to save the buffer.
356
357@item
193e6828
MA
358Again, @value{tramp} transfers the file contents to the remote host
359either inline or external. This is the reverse of what happens when
360reading the file.
4009494e
GM
361@end itemize
362
363I hope this has provided you with a basic overview of what happens
364behind the scenes when you open a file with @value{tramp}.
365
366
367@c For the end user
368@node Obtaining Tramp
369@chapter Obtaining Tramp.
370@cindex obtaining Tramp
371
372@value{tramp} is freely available on the Internet and the latest
6e7fa8e2
MA
373release may be downloaded from @uref{ftp://ftp.gnu.org/gnu/tramp/}.
374This release includes the full documentation and code for
375@value{tramp}, suitable for installation. But Emacs (22 or later)
376includes @value{tramp} already, and there is a @value{tramp} package
377for XEmacs, as well. So maybe it is easier to just use those. But if
378you want the bleeding edge, read on@dots{...}
4009494e 379
328dac0d 380For the especially brave, @value{tramp} is available from Git. The Git
4009494e
GM
381version is the latest version of the code and may contain incomplete
382features or new issues. Use these versions at your own risk.
383
384Instructions for obtaining the latest development version of @value{tramp}
328dac0d
MA
385from Git can be found by going to the Savannah project page at the
386following URL and then clicking on the Git link in the navigation bar
4009494e
GM
387at the top.
388
389@noindent
390@uref{http://savannah.gnu.org/projects/tramp/}
391
392@noindent
393Or follow the example session below:
394
395@example
396] @strong{cd ~/@value{emacsdir}}
328dac0d
MA
397] @strong{git clone git://git.savannah.gnu.org/tramp.git}
398@end example
399
400@noindent
401Tramp developers use instead
402
403@example
404] @strong{git clone login@@git.sv.gnu.org:/srv/git/tramp.git}
4009494e
GM
405@end example
406
407@noindent
408You should now have a directory @file{~/@value{emacsdir}/tramp}
409containing the latest version of @value{tramp}. You can fetch the latest
410updates from the repository by issuing the command:
411
412@example
413] @strong{cd ~/@value{emacsdir}/tramp}
328dac0d 414] @strong{git pull}
4009494e
GM
415@end example
416
417@noindent
328dac0d 418Once you've got updated files from the Git repository, you need to run
4009494e
GM
419@command{autoconf} in order to get an up-to-date @file{configure}
420script:
421
422@example
423] @strong{cd ~/@value{emacsdir}/tramp}
424] @strong{autoconf}
425@end example
426
4009494e
GM
427
428@node History
429@chapter History of @value{tramp}
430@cindex history
431@cindex development history
432
433Development was started end of November 1998. The package was called
434@file{rssh.el}, back then. It only provided one method to access a
435file, using @command{ssh} to log in to a remote host and using
436@command{scp} to transfer the file contents. After a while, the name
437was changed to @file{rcp.el}, and now it's @value{tramp}. Along the way,
438many more methods for getting a remote shell and for transferring the
439file contents were added. Support for VC was added.
440
0e7b2867
MA
441After that, there were added the multi-hop methods in April 2000 and
442the unification of @value{tramp} and Ange-FTP filenames in July 2002.
443In July 2004, multi-hop methods have been replaced by proxy hosts.
444Running commands on remote hosts was introduced in December 2005.
4009494e
GM
445@ifset emacsgw
446Support of gateways exists since April 2007.
447@end ifset
c0de5d04
MA
448@ifset emacsgvfs
449GVFS integration started in February 2009.
450@end ifset
888a7fc0
MA
451@ifset emacs
452Remote commands on Windows hosts are available since September 2011.
453@end ifset
454Ad-hoc multi-hop methods (with a changed syntax) have been reenabled
455in November 2011.
4009494e
GM
456
457In December 2001, @value{tramp} has been added to the XEmacs package
6e7fa8e2
MA
458repository. Being part of the Emacs repository happened in June 2002,
459the first release including @value{tramp} was Emacs 22.1.
4009494e 460
6e7fa8e2 461@value{tramp} is also a Debian GNU/Linux package since February 2001.
4009494e
GM
462
463
464@c Installation chapter is necessary only in case of standalone
465@c installation. Text taken from trampinst.texi.
466@ifset installchapter
467@include trampinst.texi
468@end ifset
469
470@node Configuration
471@chapter Configuring @value{tramp} for use
472@cindex configuration
473
474@cindex default configuration
475@value{tramp} is (normally) fully functional when it is initially
476installed. It is initially configured to use the @command{scp}
477program to connect to the remote host. So in the easiest case, you
478just type @kbd{C-x C-f} and then enter the filename
479@file{@trampfn{, user, machine, /path/to.file}}.
480
481On some hosts, there are problems with opening a connection. These are
482related to the behavior of the remote shell. See @xref{Remote shell
483setup}, for details on this.
484
485If you do not wish to use these commands to connect to the remote
486host, you should change the default connection and transfer method
487that @value{tramp} uses. There are several different methods that @value{tramp}
488can use to connect to remote machines and transfer files
489(@pxref{Connection types}).
490
491If you don't know which method is right for you, see @xref{Default
492Method}.
493
494
495@menu
496* Connection types:: Types of connections made to remote machines.
497* Inline methods:: Inline methods.
193e6828 498* External methods:: External methods.
88a683c5
MA
499@ifset emacsgvfs
500* GVFS based methods:: GVFS based external methods.
501@end ifset
4009494e
GM
502@ifset emacsgw
503* Gateway methods:: Gateway methods.
504@end ifset
505* Default Method:: Selecting a default method.
506 Here we also try to help those who
507 don't have the foggiest which method
508 is right for them.
509* Default User:: Selecting a default user.
510* Default Host:: Selecting a default host.
511* Multi-hops:: Connecting to a remote host using multiple hops.
512* Customizing Methods:: Using Non-Standard Methods.
513* Customizing Completion:: Selecting config files for user/host name completion.
a06a4a12 514* Password handling:: Reusing passwords for several connections.
4009494e
GM
515* Connection caching:: Reusing connection related information.
516* Remote Programs:: How @value{tramp} finds and uses programs on the remote machine.
517* Remote shell setup:: Remote shell setup hints.
518* Windows setup hints:: Issues with Cygwin ssh.
519* Auto-save and Backup:: Auto-save and Backup.
520@end menu
521
522
523@node Connection types
888a7fc0 524@section Types of connections made to remote machines
4009494e
GM
525@cindex connection types, overview
526
527There are two basic types of transfer methods, each with its own
528advantages and limitations. Both types of connection make use of a
529remote shell access program such as @command{rsh}, @command{ssh} or
530@command{telnet} to connect to the remote machine.
531
532This connection is used to perform many of the operations that @value{tramp}
533requires to make the remote file system transparently accessible from
534the local machine. It is only when visiting files that the methods
535differ.
536
537@cindex inline methods
4009494e 538@cindex external methods
4009494e 539@cindex methods, inline
193e6828 540@cindex methods, external
4009494e 541Loading or saving a remote file requires that the content of the file
333f9019
PE
542be transferred between the two machines. The content of the file can
543be transferred using one of two methods: the @dfn{inline method} over
193e6828
MA
544the same connection used to log in to the remote machine, or the
545@dfn{external method} through another connection using a remote copy
546program such as @command{rcp}, @command{scp} or @command{rsync}.
547
548The performance of the external methods is generally better than that
549of the inline methods, at least for large files. This is caused by
550the need to encode and decode the data when transferring inline.
4009494e
GM
551
552The one exception to this rule are the @command{scp} based transfer
553methods. While these methods do see better performance when actually
554transferring files, the overhead of the cryptographic negotiation at
555startup may drown out the improvement in file transfer times.
556
193e6828
MA
557External methods should be configured such a way that they don't
558require a password (with @command{ssh-agent}, or such alike). Modern
559@command{scp} implementations offer options to reuse existing
4009494e 560@command{ssh} connections, see method @command{scpc}. If it isn't
a06a4a12 561possible, you should consider @ref{Password handling}, otherwise you
4009494e
GM
562will be prompted for a password every copy action.
563
564
565@node Inline methods
566@section Inline methods
567@cindex inline methods
568@cindex methods, inline
569
570The inline methods in @value{tramp} are quite powerful and can work in
571situations where you cannot use an external transfer program to connect.
572Inline methods are the only methods that work when connecting to the
573remote machine via telnet. (There are also strange inline methods which
574allow you to transfer files between @emph{user identities} rather than
575hosts, see below.)
576
577These methods depend on the existence of a suitable encoding and
578decoding command on remote machine. Locally, @value{tramp} may be able to
579use features of @value{emacsname} to decode and encode the files or
580it may require access to external commands to perform that task.
581
582@cindex uuencode
583@cindex mimencode
584@cindex base-64 encoding
585@value{tramp} checks the availability and usability of commands like
586@command{mimencode} (part of the @command{metamail} package) or
587@command{uuencode} on the remote host. The first reliable command
588will be used. The search path can be customized, see @ref{Remote
589Programs}.
590
591If both commands aren't available on the remote host, @value{tramp}
592transfers a small piece of Perl code to the remote host, and tries to
593apply it for encoding and decoding.
594
502269d6
MA
595The variable @var{tramp-inline-compress-start-size} controls, whether
596a file shall be compressed before encoding. This could increase
597transfer speed for large text files.
598
4009494e
GM
599
600@table @asis
601@item @option{rsh}
602@cindex method rsh
603@cindex rsh method
604
605Connect to the remote host with @command{rsh}. Due to the unsecure
606connection it is recommended for very local host topology only.
607
608On operating systems which provide the command @command{remsh} instead
609of @command{rsh}, you can use the method @option{remsh}. This is true
610for HP-UX or Cray UNICOS, for example.
611
612
613@item @option{ssh}
614@cindex method ssh
615@cindex ssh method
616
617Connect to the remote host with @command{ssh}. This is identical to
618the previous option except that the @command{ssh} package is used,
619making the connection more secure.
620
621There are also two variants, @option{ssh1} and @option{ssh2}, that
622call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
623explicitly select whether you want to use the SSH protocol version 1
624or 2 to connect to the remote host. (You can also specify in
625@file{~/.ssh/config}, the SSH configuration file, which protocol
626should be used, and use the regular @option{ssh} method.)
627
ca1bb391
MA
628All the methods based on @command{ssh} have an additional feature: you
629can specify a host name which looks like @file{host#42} (the real host
630name, then a hash sign, then a port number). This means to connect to
631the given host but to also pass @code{-p 42} as arguments to the
632@command{ssh} command.
4009494e
GM
633
634
635@item @option{telnet}
636@cindex method telnet
637@cindex telnet method
638
639Connect to the remote host with @command{telnet}. This is as unsecure
640as the @option{rsh} method.
641
642
643@item @option{su}
644@cindex method su
645@cindex su method
646
647This method does not connect to a remote host at all, rather it uses
648the @command{su} program to allow you to edit files as another user.
4605b7cd
MA
649That means, the specified host name in the file name must be either
650@samp{localhost} or the host name as returned by the function
651@command{(system-name)}. For an exception of this rule see
652@ref{Multi-hops}.
4009494e
GM
653
654
655@item @option{sudo}
656@cindex method sudo
657@cindex sudo method
658
659This is similar to the @option{su} method, but it uses @command{sudo}
660rather than @command{su} to become a different user.
661
662Note that @command{sudo} must be configured to allow you to start a
663shell as the user. It would be nice if it was sufficient if
664@command{ls} and @command{mimencode} were allowed, but that is not
665easy to implement, so I haven't got around to it, yet.
666
667
668@item @option{sshx}
669@cindex method sshx
670@cindex sshx method
671
672As you would expect, this is similar to @option{ssh}, only a little
673different. Whereas @option{ssh} opens a normal interactive shell on
674the remote host, this option uses @samp{ssh -t -t @var{host} -l
675@var{user} /bin/sh} to open a connection. This is useful for users
676where the normal login shell is set up to ask them a number of
677questions when logging in. This procedure avoids these questions, and
678just gives @value{tramp} a more-or-less `standard' login shell to work
679with.
680
681Note that this procedure does not eliminate questions asked by
682@command{ssh} itself. For example, @command{ssh} might ask ``Are you
683sure you want to continue connecting?'' if the host key of the remote
684host is not known. @value{tramp} does not know how to deal with such a
685question (yet), therefore you will need to make sure that you can log
686in without such questions.
687
688This is also useful for Windows users where @command{ssh}, when
689invoked from an @value{emacsname} buffer, tells them that it is not
690allocating a pseudo tty. When this happens, the login shell is wont
691to not print any shell prompt, which confuses @value{tramp} mightily.
4009494e 692
7494b873 693This supports the @samp{-p} argument.
4009494e
GM
694
695
696@item @option{krlogin}
697@cindex method krlogin
698@cindex krlogin method
699@cindex Kerberos (with krlogin method)
700
701This method is also similar to @option{ssh}. It only uses the
702@command{krlogin -x} command to log in to the remote host.
703
704
305bdd22
MA
705@item @option{ksu}
706@cindex method ksu
707@cindex ksu method
708@cindex Kerberos (with ksu method)
709
710This is another method from the Kerberos suite. It behaves like @option{su}.
711
712
4009494e
GM
713@item @option{plink}
714@cindex method plink
715@cindex plink method
716
717This method is mostly interesting for Windows users using the PuTTY
1df7defd 718implementation of SSH@. It uses @samp{plink -ssh} to log in to the
4009494e
GM
719remote host.
720
7494b873 721This supports the @samp{-P} argument.
4009494e
GM
722
723Additionally, the methods @option{plink1} and @option{plink2} are
724provided, which call @samp{plink -1 -ssh} or @samp{plink -2 -ssh} in
725order to use SSH protocol version 1 or 2 explicitly.
726
727CCC: Do we have to connect to the remote host once from the command
728line to accept the SSH key? Maybe this can be made automatic?
729
730CCC: Say something about the first shell command failing. This might
731be due to a wrong setting of @code{tramp-rsh-end-of-line}.
732
733
734@item @option{plinkx}
735@cindex method plinkx
736@cindex plinkx method
737
738Another method using PuTTY on Windows. Instead of host names, it
739expects PuTTY session names, calling @samp{plink -load @var{session}
740-t"}. User names are relevant only in case the corresponding session
741hasn't defined a user name. Different port numbers must be defined in
742the session.
743
4009494e
GM
744@end table
745
746
193e6828
MA
747@node External methods
748@section External methods
749@cindex methods, external
750@cindex external methods
4009494e 751
193e6828
MA
752The external methods operate through multiple channels, using the
753remote shell connection for many actions while delegating file
4009494e
GM
754transfers to an external transfer utility.
755
756This saves the overhead of encoding and decoding that multiplexing the
757transfer through the one connection has with the inline methods.
758
193e6828
MA
759Since external methods need their own overhead opening a new channel,
760all files which are smaller than @var{tramp-copy-size-limit} are still
761transferred with the corresponding inline method. It should provide a
762fair trade-off between both approaches.
4009494e
GM
763
764@table @asis
765@item @option{rcp} --- @command{rsh} and @command{rcp}
766@cindex method rcp
767@cindex rcp method
768@cindex rcp (with rcp method)
769@cindex rsh (with rcp method)
770
771This method uses the @command{rsh} and @command{rcp} commands to connect
772to the remote machine and transfer files. This is probably the fastest
773connection method available.
774
775The alternative method @option{remcp} uses the @command{remsh} and
776@command{rcp} commands. It should be applied on machines where
777@command{remsh} is used instead of @command{rsh}.
778
779
780@item @option{scp} --- @command{ssh} and @command{scp}
781@cindex method scp
782@cindex scp method
783@cindex scp (with scp method)
784@cindex ssh (with scp method)
785
786Using @command{ssh} to connect to the remote host and @command{scp} to
787transfer files between the machines is the best method for securely
788connecting to a remote machine and accessing files.
789
790The performance of this option is also quite good. It may be slower than
791the inline methods when you often open and close small files however.
792The cost of the cryptographic handshake at the start of an @command{scp}
793session can begin to absorb the advantage that the lack of encoding and
794decoding presents.
795
796There are also two variants, @option{scp1} and @option{scp2}, that
797call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
798explicitly select whether you want to use the SSH protocol version 1
799or 2 to connect to the remote host. (You can also specify in
800@file{~/.ssh/config}, the SSH configuration file, which protocol
801should be used, and use the regular @option{scp} method.)
802
7494b873
MA
803All the @command{ssh} based methods support the @samp{-p} feature
804where you can specify a port number to connect to in the host name.
805For example, the host name @file{host#42} tells @value{tramp} to
4009494e
GM
806specify @samp{-p 42} in the argument list for @command{ssh}, and to
807specify @samp{-P 42} in the argument list for @command{scp}.
808
809
810@item @option{sftp} --- @command{ssh} and @command{sftp}
811@cindex method sftp
812@cindex sftp method
813@cindex sftp (with sftp method)
814@cindex ssh (with sftp method)
815
816That is mostly the same method as @option{scp}, but using
817@command{sftp} as transfer command. So the same remarks are valid.
818
819This command does not work like @value{ftppackagename}, where
820@command{ftp} is called interactively, and all commands are send from
821within this session. Instead of, @command{ssh} is used for login.
822
7494b873 823This method supports the @samp{-p} argument.
4009494e
GM
824
825
826@item @option{rsync} --- @command{ssh} and @command{rsync}
827@cindex method rsync
828@cindex rsync method
829@cindex rsync (with rsync method)
830@cindex ssh (with rsync method)
831
832Using the @command{ssh} command to connect securely to the remote
833machine and the @command{rsync} command to transfer files is almost
834identical to the @option{scp} method.
835
836While @command{rsync} performs much better than @command{scp} when
837transferring files that exist on both hosts, this advantage is lost if
c0de5d04
MA
838the file exists only on one side of the connection. A file can exists
839on both the remote and local host, when you copy a file from/to a
840remote host. When you just open a file from the remote host (or write
637f4f0f
MA
841a file there), a temporary file on the local side is kept as long as
842the corresponding buffer, visiting this file, is alive.
4009494e 843
7494b873 844This method supports the @samp{-p} argument.
4009494e
GM
845
846
847@item @option{scpx} --- @command{ssh} and @command{scp}
848@cindex method scpx
849@cindex scpx method
850@cindex scp (with scpx method)
851@cindex ssh (with scpx method)
852
853As you would expect, this is similar to @option{scp}, only a little
854different. Whereas @option{scp} opens a normal interactive shell on
855the remote host, this option uses @samp{ssh -t -t @var{host} -l
856@var{user} /bin/sh} to open a connection. This is useful for users
857where the normal login shell is set up to ask them a number of
858questions when logging in. This procedure avoids these questions, and
859just gives @value{tramp} a more-or-less `standard' login shell to work
860with.
861
862This is also useful for Windows users where @command{ssh}, when
863invoked from an @value{emacsname} buffer, tells them that it is not
864allocating a pseudo tty. When this happens, the login shell is wont
865to not print any shell prompt, which confuses @value{tramp} mightily.
866
7494b873 867This method supports the @samp{-p} argument.
4009494e
GM
868
869
870@item @option{scpc} --- @command{ssh} and @command{scp}
b59329e0
MA
871@cindex method scpc
872@cindex scpc method
873@cindex scp (with scpc method)
874@cindex ssh (with scpc method)
4009494e
GM
875
876Newer versions of @option{ssh} (for example OpenSSH 4) offer an option
877@option{ControlMaster}. This allows @option{scp} to reuse an existing
878@option{ssh} channel, which increases performance.
879
02dc2fd7
EH
880Before you use this method, you should check whether your @option{ssh}
881implementation supports this option. Try from the command line
4009494e
GM
882
883@example
02dc2fd7 884ssh localhost -o ControlMaster=yes /bin/true
4009494e
GM
885@end example
886
02dc2fd7
EH
887If that command succeeds silently, then you can use @option{scpc}; but
888if it fails like
889
890@example
891command-line: line 0: Bad configuration option: ControlMaster
892@end example
893
888a7fc0
MA
894then you cannot use it. Note, that the option
895@option{ControlPersist}, if it is supported by your @option{ssh}
896version, must be set to @option{no}.
02dc2fd7 897
7494b873 898This method supports the @samp{-p} argument.
4009494e
GM
899
900
b59329e0
MA
901@item @option{rsyncc} --- @command{ssh} and @command{rsync}
902@cindex method rsyncc
903@cindex rsyncc method
904@cindex rsync (with rsyncc method)
905@cindex ssh (with rsyncc method)
906
907Like the @option{scpc} method, @option{rsyncc} improves the underlying
908@command{ssh} connection by the option @option{ControlMaster}. This
909allows @command{rsync} to reuse an existing @command{ssh} channel,
910which increases performance.
911
912This method supports the @samp{-p} argument.
913
914
4009494e
GM
915@item @option{pscp} --- @command{plink} and @command{pscp}
916@cindex method pscp
917@cindex pscp method
918@cindex pscp (with pscp method)
919@cindex plink (with pscp method)
920@cindex PuTTY (with pscp method)
921
922This method is similar to @option{scp}, but it uses the
923@command{plink} command to connect to the remote host, and it uses
924@command{pscp} for transferring the files. These programs are part
925of PuTTY, an SSH implementation for Windows.
926
7494b873 927This method supports the @samp{-P} argument.
4009494e
GM
928
929
930@item @option{psftp} --- @command{plink} and @command{psftp}
931@cindex method psftp
932@cindex psftp method
933@cindex psftp (with psftp method)
934@cindex plink (with psftp method)
935@cindex PuTTY (with psftp method)
936
937As you would expect, this method is similar to @option{sftp}, but it
938uses the @command{plink} command to connect to the remote host, and it
939uses @command{psftp} for transferring the files. These programs are
940part of PuTTY, an SSH implementation for Windows.
941
7494b873 942This method supports the @samp{-P} argument.
4009494e
GM
943
944
945@item @option{fcp} --- @command{fsh} and @command{fcp}
946@cindex method fcp
947@cindex fcp method
948@cindex fsh (with fcp method)
949@cindex fcp (with fcp method)
950
951This method is similar to @option{scp}, but it uses the @command{fsh}
952command to connect to the remote host, and it uses @command{fcp} for
953transferring the files. @command{fsh/fcp} are a front-end for
954@command{ssh} which allow for reusing the same @command{ssh} session
955for submitting several commands. This avoids the startup overhead of
956@command{scp} (which has to establish a secure connection whenever it
957is called). Note, however, that you can also use one of the inline
958methods to achieve a similar effect.
959
960This method uses the command @samp{fsh @var{host} -l @var{user}
961/bin/sh -i} to establish the connection, it does not work to just say
962@command{fsh @var{host} -l @var{user}}.
963
964@cindex method fsh
965@cindex fsh method
966
967There is no inline method using @command{fsh} as the multiplexing
968provided by the program is not very useful in our context. @value{tramp}
969opens just one connection to the remote host and then keeps it open,
970anyway.
971
972
973@item @option{ftp}
974@cindex method ftp
975@cindex ftp method
976
36539990 977This is not a native @value{tramp} method. Instead, it forwards all
4009494e
GM
978requests to @value{ftppackagename}.
979@ifset xemacs
980This works only for unified filenames, see @ref{Issues}.
981@end ifset
982
983
984@item @option{smb} --- @command{smbclient}
985@cindex method smb
986@cindex smb method
987
328dac0d 988This is another not native @value{tramp} method. It uses the
4009494e
GM
989@command{smbclient} command on different Unices in order to connect to
990an SMB server. An SMB server might be a Samba (or CIFS) server on
991another UNIX host or, more interesting, a host running MS Windows. So
888a7fc0
MA
992far, it is tested against MS Windows NT, MS Windows 2000, MS Windows
993XP, MS Windows Vista, and MS Windows 7.
4009494e
GM
994
995The first directory in the localname must be a share name on the remote
36539990 996host. Remember that the @code{$} character, in which default shares
4009494e 997usually end, must be written @code{$$} due to environment variable
1df7defd 998substitution in file names. If no share name is given (i.e., remote
4009494e
GM
999directory @code{/}), all available shares are listed.
1000
36539990
MA
1001Since authorization is done on share level, you will always be
1002prompted for a password if you access another share on the same host.
a06a4a12 1003This can be suppressed by @ref{Password handling}.
4009494e 1004
36539990 1005For authorization, MS Windows uses both a user name and a domain name.
4009494e
GM
1006Because of this, the @value{tramp} syntax has been extended: you can
1007specify a user name which looks like @code{user%domain} (the real user
1008name, then a percent sign, then the domain name). So, to connect to
1009the machine @code{melancholia} as user @code{daniel} of the domain
1010@code{BIZARRE}, and edit @file{.emacs} in the home directory (share
1011@code{daniel$}) I would specify the filename @file{@trampfn{smb,
1012daniel%BIZARRE, melancholia, /daniel$$/.emacs}}.
1013
1014Depending on the Windows domain configuration, a Windows user might be
1015considered as domain user per default. In order to connect as local
1016user, the WINS name of that machine must be given as domain name.
1017Usually, it is the machine name in capital letters. In the example
1018above, the local user @code{daniel} would be specified as
1019@file{@trampfn{smb, daniel%MELANCHOLIA, melancholia, /daniel$$/.emacs}}.
1020
1021The domain name as well as the user name are optional. If no user
1022name is specified at all, the anonymous user (without password
1023prompting) is assumed. This is different from all other @value{tramp}
1024methods, where in such a case the local user name is taken.
1025
7494b873 1026The @option{smb} method supports the @samp{-p} argument.
4009494e
GM
1027
1028@strong{Please note:} If @value{emacsname} runs locally under MS
36539990 1029Windows, this method isn't available. Instead, you can use UNC
4009494e
GM
1030file names like @file{//melancholia/daniel$$/.emacs}. The only
1031disadvantage is that there's no possibility to specify another user
1032name.
88a683c5
MA
1033@end table
1034
4009494e 1035
c0de5d04 1036@ifset emacsgvfs
88a683c5
MA
1037@node GVFS based methods
1038@section GVFS based external methods
1039@cindex methods, gvfs
1040@cindex gvfs based methods
1041@cindex dbus
c0de5d04 1042
88a683c5 1043The connection methods described in this section are based on GVFS
c0de5d04 1044@uref{http://en.wikipedia.org/wiki/GVFS}. Via GVFS, the remote
1df7defd 1045filesystem is mounted locally through FUSE@. @value{tramp} uses
36539990 1046this local mounted directory internally.
c0de5d04
MA
1047
1048The communication with GVFS is implemented via D-Bus messages.
88a683c5
MA
1049Therefore, your @value{emacsname} must have D-Bus integration,
1050@pxref{Top, , D-Bus, dbus}.
c0de5d04 1051
88a683c5
MA
1052@table @asis
1053@item @option{dav}
1054@cindex method dav
0e7b2867 1055@cindex method davs
88a683c5 1056@cindex dav method
0e7b2867 1057@cindex davs method
88a683c5
MA
1058
1059This method provides access to WebDAV files and directories. There
1060exists also the external method @option{davs}, which uses SSL
c0de5d04
MA
1061encryption for the access.
1062
1063Both methods support the port number specification as discussed above.
1064
0e7b2867 1065
c0de5d04
MA
1066@item @option{obex}
1067@cindex method obex
1068@cindex obex method
1069
1070OBEX is an FTP-like access protocol for simple devices, like cell
36539990 1071phones. For the time being, @value{tramp} only supports OBEX over Bluetooth.
7494b873 1072
0e7b2867 1073
7494b873
MA
1074@item @option{synce}
1075@cindex method synce
1076@cindex synce method
1077
88a683c5
MA
1078The @option{synce} method allows communication with Windows Mobile
1079devices. Beside GVFS for mounting remote files and directories via
36539990 1080FUSE, it also needs the SYNCE-GVFS plugin.
4009494e
GM
1081@end table
1082
c0de5d04 1083@defopt tramp-gvfs-methods
36539990 1084This customer option, a list, defines the external methods which
1df7defd 1085shall be used with GVFS@. Per default, these are @option{dav},
7494b873
MA
1086@option{davs}, @option{obex} and @option{synce}. Other possible
1087values are @option{ftp}, @option{sftp} and @option{smb}.
c0de5d04
MA
1088@end defopt
1089@end ifset
1090
4009494e
GM
1091
1092@ifset emacsgw
1093@node Gateway methods
1094@section Gateway methods
1095@cindex methods, gateway
1096@cindex gateway methods
1097
1098Gateway methods are not methods to access a remote host directly.
1099These methods are intended to pass firewalls or proxy servers.
1100Therefore, they can be used for proxy host declarations
1101(@pxref{Multi-hops}) only.
1102
36539990 1103A gateway method must always come along with a method which supports
7494b873
MA
1104port setting. This is because @value{tramp} targets the accompanied
1105method to @file{localhost#random_port}, from where the firewall or
36539990 1106proxy server is accessed.
4009494e
GM
1107
1108Gateway methods support user name and password declarations. These
1109are used to authenticate towards the corresponding firewall or proxy
1110server. They can be passed only if your friendly administrator has
1111granted your access.
1112
1113@table @asis
1114@item @option{tunnel}
1115@cindex method tunnel
1116@cindex tunnel method
1117
1118This method implements an HTTP tunnel via the @command{CONNECT}
1119command (see RFC 2616, 2817). Any HTTP 1.1 compliant (proxy) server
1120shall support this command.
1121
1122As authentication method, only @option{Basic Authentication} (see RFC
11232617) is implemented so far. If no port number is given in the
1124declaration, port @option{8080} is used for the proxy server.
1125
1126
1127@item @option{socks}
1128@cindex method socks
1129@cindex socks method
1130
1131The @command{socks} method provides access to SOCKSv5 servers (see
1132RFC 1928). @option{Username/Password Authentication} according to RFC
11331929 is supported.
1134
1135The default port number of the socks server is @option{1080}, if not
1136specified otherwise.
1137
1138@end table
1139@end ifset
1140
1141
1142@node Default Method
1143@section Selecting a default method
1144@cindex default method
1145
1146@vindex tramp-default-method
1147When you select an appropriate transfer method for your typical usage
1148you should set the variable @code{tramp-default-method} to reflect that
1149choice. This variable controls which method will be used when a method
1150is not specified in the @value{tramp} file name. For example:
1151
1152@lisp
1153(setq tramp-default-method "ssh")
1154@end lisp
1155
1156@vindex tramp-default-method-alist
1157You can also specify different methods for certain user/host
1158combinations, via the variable @code{tramp-default-method-alist}. For
1159example, the following two lines specify to use the @option{ssh}
1160method for all user names matching @samp{john} and the @option{rsync}
1161method for all host names matching @samp{lily}. The third line
1162specifies to use the @option{su} method for the user @samp{root} on
1163the machine @samp{localhost}.
1164
1165@lisp
1166(add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
1167(add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1168(add-to-list 'tramp-default-method-alist
1169 '("\\`localhost\\'" "\\`root\\'" "su"))
1170@end lisp
1171
1172@noindent
1173See the documentation for the variable
1174@code{tramp-default-method-alist} for more details.
1175
193e6828
MA
1176External methods are normally preferable to inline methods, giving
1177better performance.
4009494e
GM
1178
1179@xref{Inline methods}.
193e6828 1180@xref{External methods}.
4009494e
GM
1181
1182Another consideration with the selection of transfer methods is the
1183environment you will use them in and, especially when used over the
1184Internet, the security implications of your preferred method.
1185
1186The @option{rsh} and @option{telnet} methods send your password as
1187plain text as you log in to the remote machine, as well as
1188transferring the files in such a way that the content can easily be
1189read from other machines.
1190
1191If you need to connect to remote systems that are accessible from the
1192Internet, you should give serious thought to using @option{ssh} based
1193methods to connect. These provide a much higher level of security,
1194making it a non-trivial exercise for someone to obtain your password
1195or read the content of the files you are editing.
1196
1197
1198@subsection Which method is the right one for me?
1199@cindex choosing the right method
1200
1201Given all of the above, you are probably thinking that this is all fine
1202and good, but it's not helping you to choose a method! Right you are.
1203As a developer, we don't want to boss our users around but give them
1204maximum freedom instead. However, the reality is that some users would
1205like to have some guidance, so here I'll try to give you this guidance
1206without bossing you around. You tell me whether it works @dots{}
1207
193e6828
MA
1208My suggestion is to use an inline method. For large files, external
1209methods might be more efficient, but I guess that most people will
502269d6
MA
1210want to edit mostly small files. And if you access large text files,
1211compression (driven by @var{tramp-inline-compress-start-size}) shall
1212still result in good performance.
4009494e
GM
1213
1214I guess that these days, most people can access a remote machine by
1215using @command{ssh}. So I suggest that you use the @option{ssh}
1216method. So, type @kbd{C-x C-f @trampfn{ssh, root, otherhost,
1217/etc/motd} @key{RET}} to edit the @file{/etc/motd} file on the other
1218host.
1219
1220If you can't use @option{ssh} to log in to the remote host, then
1221select a method that uses a program that works. For instance, Windows
1222users might like the @option{plink} method which uses the PuTTY
1223implementation of @command{ssh}. Or you use Kerberos and thus like
1224@option{krlogin}.
1225
1226For the special case of editing files on the local host as another
1227user, see the @option{su} or @option{sudo} methods. They offer
1228shortened syntax for the @samp{root} account, like
1229@file{@trampfn{su, , , /etc/motd}}.
1230
1231People who edit large files may want to consider @option{scpc} instead
1232of @option{ssh}, or @option{pscp} instead of @option{plink}. These
193e6828
MA
1233external methods are faster than inline methods for large files.
1234Note, however, that external methods suffer from some limitations.
4009494e 1235Please try first whether you really get a noticeable speed advantage
193e6828 1236from using an external method! Maybe even for large files, inline
4009494e
GM
1237methods are fast enough.
1238
1239
1240@node Default User
1241@section Selecting a default user
1242@cindex default user
1243
1244The user part of a @value{tramp} file name can be omitted. Usually,
1245it is replaced by the user name you are logged in. Often, this is not
1246what you want. A typical use of @value{tramp} might be to edit some
1247files with root permissions on the local host. This case, you should
1248set the variable @code{tramp-default-user} to reflect that choice.
1249For example:
1250
1251@lisp
1252(setq tramp-default-user "root")
1253@end lisp
1254
1255@code{tramp-default-user} is regarded as obsolete, and will be removed
1256soon.
1257
1258@vindex tramp-default-user-alist
1259You can also specify different users for certain method/host
1260combinations, via the variable @code{tramp-default-user-alist}. For
1261example, if you always have to use the user @samp{john} in the domain
1262@samp{somewhere.else}, you can specify the following:
1263
1264@lisp
1265(add-to-list 'tramp-default-user-alist
1266 '("ssh" ".*\\.somewhere\\.else\\'" "john"))
1267@end lisp
1268
1269@noindent
1270See the documentation for the variable
1271@code{tramp-default-user-alist} for more details.
1272
1273One trap to fall in must be known. If @value{tramp} finds a default
1274user, this user will be passed always to the connection command as
888a7fc0
MA
1275parameter (for example @command{ssh here.somewhere.else -l john}. If
1276you have specified another user for your command in its configuration
4009494e
GM
1277files, @value{tramp} cannot know it, and the remote access will fail.
1278If you have specified in the given example in @file{~/.ssh/config} the
1279lines
1280
1281@example
1282Host here.somewhere.else
1283 User lily
1284@end example
1285
1286@noindent
1287than you must discard selecting a default user by @value{tramp}. This
1288will be done by setting it to @code{nil} (or @samp{lily}, likewise):
1289
1290@lisp
1291(add-to-list 'tramp-default-user-alist
1292 '("ssh" "\\`here\\.somewhere\\.else\\'" nil))
1293@end lisp
1294
1295The last entry in @code{tramp-default-user-alist} could be your
1296default user you'll apply predominantly. You shall @emph{append} it
1297to that list at the end:
1298
1299@lisp
1300(add-to-list 'tramp-default-user-alist '(nil nil "jonas") t)
1301@end lisp
1302
1303
1304@node Default Host
1305@section Selecting a default host
1306@cindex default host
1307
1308@vindex tramp-default-host
1309Finally, it is even possible to omit the host name part of a
1310@value{tramp} file name. This case, the value of the variable
1311@code{tramp-default-host} is used. Per default, it is initialized
1312with the host name your local @value{emacsname} is running.
1313
1314If you, for example, use @value{tramp} mainly to contact the host
1315@samp{target} as user @samp{john}, you can specify:
1316
1317@lisp
1318(setq tramp-default-user "john"
1319 tramp-default-host "target")
1320@end lisp
1321
1322Then the simple file name @samp{@trampfn{ssh, , ,}} will connect you
1323to John's home directory on target.
1324@ifset emacs
1325Note, however, that the most simplification @samp{/::} won't work,
1326because @samp{/:} is the prefix for quoted file names.
1327@end ifset
1328
1329
1330@node Multi-hops
1331@section Connecting to a remote host using multiple hops
1332@cindex multi-hop
1333@cindex proxy hosts
1334
ef091c97
MA
1335Sometimes, the methods described before are not sufficient.
1336Sometimes, it is not possible to connect to a remote host using a
1337simple command. For example, if you are in a secured network, you
1338might have to log in to a bastion host first before you can connect to
1339the outside world. Of course, the target host may also require a
1340bastion host.
4009494e
GM
1341
1342@vindex tramp-default-proxies-alist
ef091c97
MA
1343@defopt tramp-default-proxies-alist
1344In order to specify multiple hops, it is possible to define a proxy
4009494e
GM
1345host to pass through, via the variable
1346@code{tramp-default-proxies-alist}. This variable keeps a list of
1347triples (@var{host} @var{user} @var{proxy}).
1348
ef091c97 1349The first matching item specifies the proxy host to be passed for a
4009494e
GM
1350file name located on a remote target matching @var{user}@@@var{host}.
1351@var{host} and @var{user} are regular expressions or @code{nil}, which
1352is interpreted as a regular expression which always matches.
1353
1354@var{proxy} must be a Tramp filename which localname part is ignored.
1355Method and user name on @var{proxy} are optional, which is interpreted
1356with the default values.
1357@ifset emacsgw
1358The method must be an inline or gateway method (@pxref{Inline
1359methods}, @pxref{Gateway methods}).
1360@end ifset
1361@ifclear emacsgw
1362The method must be an inline method (@pxref{Inline methods}).
1363@end ifclear
1364If @var{proxy} is @code{nil}, no additional hop is required reaching
1365@var{user}@@@var{host}.
1366
1367If you, for example, must pass the host @samp{bastion.your.domain} as
1368user @samp{bird} for any remote host which is not located in your local
1369domain, you can set
1370
1371@lisp
1372(add-to-list 'tramp-default-proxies-alist
1373 '("\\." nil "@trampfn{ssh, bird, bastion.your.domain,}"))
1374(add-to-list 'tramp-default-proxies-alist
1375 '("\\.your\\.domain\\'" nil nil))
1376@end lisp
1377
1378Please note the order of the code. @code{add-to-list} adds elements at the
1379beginning of a list. Therefore, most relevant rules must be added last.
1380
1381Proxy hosts can be cascaded. If there is another host called
1382@samp{jump.your.domain}, which is the only one in your local domain who
1383is allowed connecting @samp{bastion.your.domain}, you can add another
1384rule:
1385
1386@lisp
1387(add-to-list 'tramp-default-proxies-alist
1388 '("\\`bastion\\.your\\.domain\\'"
1389 "\\`bird\\'"
1390 "@trampfn{ssh, , jump.your.domain,}"))
1391@end lisp
1392
1393@var{proxy} can contain the patterns @code{%h} or @code{%u}. These
1394patterns are replaced by the strings matching @var{host} or
1395@var{user}, respectively.
1396
1397If you, for example, wants to work as @samp{root} on hosts in the
1398domain @samp{your.domain}, but login as @samp{root} is disabled for
1399non-local access, you might add the following rule:
1400
1401@lisp
1402(add-to-list 'tramp-default-proxies-alist
1403 '("\\.your\\.domain\\'" "\\`root\\'" "@trampfn{ssh, , %h,}"))
1404@end lisp
1405
1406Opening @file{@trampfn{sudo, , randomhost.your.domain,}} would connect
1407first @samp{randomhost.your.domain} via @code{ssh} under your account
1408name, and perform @code{sudo -u root} on that host afterwards. It is
1409important to know that the given method is applied on the host which
1410has been reached so far. @code{sudo -u root}, applied on your local
1411host, wouldn't be useful here.
1412
c0de5d04
MA
1413@var{host}, @var{user} and @var{proxy} can also be Lisp forms. These
1414forms are evaluated, and must return a string, or @code{nil}. The
1415previous example could be generalized then: For all hosts except my
888a7fc0
MA
1416local one connect via @command{ssh} first, and apply @command{sudo -u
1417root} afterwards:
c0de5d04
MA
1418
1419@lisp
1420(add-to-list 'tramp-default-proxies-alist
1421 '(nil "\\`root\\'" "@trampfn{ssh, , %h,}"))
1422(add-to-list 'tramp-default-proxies-alist
1423 '((regexp-quote (system-name)) nil nil))
1424@end lisp
1425
4009494e
GM
1426This is the recommended configuration to work as @samp{root} on remote
1427Ubuntu hosts.
1428
1429@ifset emacsgw
1430Finally, @code{tramp-default-proxies-alist} can be used to pass
1431firewalls or proxy servers. Imagine your local network has a host
1432@samp{proxy.your.domain} which is used on port 3128 as HTTP proxy to
1433the outer world. Your friendly administrator has granted you access
1434under your user name to @samp{host.other.domain} on that proxy
1435server.@footnote{HTTP tunnels are intended for secure SSL/TLS
1436communication. Therefore, many proxy server restrict the tunnels to
1437related target ports. You might need to run your ssh server on your
1438target host @samp{host.other.domain} on such a port, like 443 (https).
1439See @uref{http://savannah.gnu.org/maintenance/CvsFromBehindFirewall}
1440for discussion of ethical issues.} You would need to add the
1441following rule:
1442
1443@lisp
1444(add-to-list 'tramp-default-proxies-alist
1445 '("\\`host\\.other\\.domain\\'" nil
1446 "@trampfn{tunnel, , proxy.your.domain#3128,}"))
1447@end lisp
1448
1449Gateway methods can be declared as first hop only in a multiple hop
1450chain.
1451@end ifset
ef091c97
MA
1452@end defopt
1453
1454Hops to be passed tend to be restricted firewalls and alike.
1455Sometimes they offer limited features only, like running @command{rbash}
1456(restricted bash). This must be told to @value{tramp}.
1457
1458@vindex tramp-restricted-shell-hosts-alist
1459@defopt tramp-restricted-shell-hosts-alist
1460This variable keeps a list of regular expressions, which denote hosts
1461running a registered shell like "rbash". Those hosts can be used as
1462proxies only.
1463
1464If the bastion host from the example above runs a restricted shell,
1465you shall apply
1466
1467@lisp
1468(add-to-list 'tramp-restricted-shell-hosts-alist
1469 "\\`bastion\\.your\\.domain\\'")
1470@end lisp
1471@end defopt
4009494e
GM
1472
1473
1474@node Customizing Methods
1475@section Using Non-Standard Methods
1476@cindex customizing methods
1477@cindex using non-standard methods
1478@cindex create your own methods
1479
1480There is a variable @code{tramp-methods} which you can change if the
1481predefined methods don't seem right.
1482
1483For the time being, I'll refer you to the Lisp documentation of that
1484variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1485
1486
1487@node Customizing Completion
1488@section Selecting config files for user/host name completion
1489@cindex customizing completion
1490@cindex selecting config files
1491@vindex tramp-completion-function-alist
1492
1493The variable @code{tramp-completion-function-alist} is intended to
1494customize which files are taken into account for user and host name
1495completion (@pxref{Filename completion}). For every method, it keeps
1496a set of configuration files, accompanied by a Lisp function able to
1497parse that file. Entries in @code{tramp-completion-function-alist}
1498have the form (@var{method} @var{pair1} @var{pair2} ...).
1499
1500Each @var{pair} is composed of (@var{function} @var{file}).
1501@var{function} is responsible to extract user names and host names
1502from @var{file} for completion. There are two functions which access
1503this variable:
1504
1505@defun tramp-get-completion-function method
1506This function returns the list of completion functions for @var{method}.
1507
1508Example:
1509@example
1510(tramp-get-completion-function "rsh")
1511
1512 @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1513 (tramp-parse-rhosts "~/.rhosts"))
1514@end example
1515@end defun
1516
1517@defun tramp-set-completion-function method function-list
1518This function sets @var{function-list} as list of completion functions
1519for @var{method}.
1520
1521Example:
1522@example
1523(tramp-set-completion-function "ssh"
1524 '((tramp-parse-sconfig "/etc/ssh_config")
1525 (tramp-parse-sconfig "~/.ssh/config")))
1526
1527 @result{} ((tramp-parse-sconfig "/etc/ssh_config")
1528 (tramp-parse-sconfig "~/.ssh/config"))
1529@end example
1530@end defun
1531
1532The following predefined functions parsing configuration files exist:
1533
1534@table @asis
1535@item @code{tramp-parse-rhosts}
1536@findex tramp-parse-rhosts
1537
1538This function parses files which are syntactical equivalent to
1539@file{~/.rhosts}. It returns both host names and user names, if
1540specified.
1541
1542@item @code{tramp-parse-shosts}
1543@findex tramp-parse-shosts
1544
1545This function parses files which are syntactical equivalent to
1546@file{~/.ssh/known_hosts}. Since there are no user names specified
1547in such files, it can return host names only.
1548
1549@item @code{tramp-parse-sconfig}
1550@findex tramp-parse-shosts
1551
1552This function returns the host nicknames defined by @code{Host} entries
1553in @file{~/.ssh/config} style files.
1554
1555@item @code{tramp-parse-shostkeys}
1556@findex tramp-parse-shostkeys
1557
1558SSH2 parsing of directories @file{/etc/ssh2/hostkeys/*} and
1559@file{~/ssh2/hostkeys/*}. Hosts are coded in file names
1560@file{hostkey_@var{portnumber}_@var{host-name}.pub}. User names
1561are always @code{nil}.
1562
1563@item @code{tramp-parse-sknownhosts}
1564@findex tramp-parse-shostkeys
1565
1566Another SSH2 style parsing of directories like
1567@file{/etc/ssh2/knownhosts/*} and @file{~/ssh2/knownhosts/*}. This
1568case, hosts names are coded in file names
1569@file{@var{host-name}.@var{algorithm}.pub}. User names are always @code{nil}.
1570
1571@item @code{tramp-parse-hosts}
1572@findex tramp-parse-hosts
1573
1574A function dedicated to @file{/etc/hosts} style files. It returns
1575host names only.
1576
1577@item @code{tramp-parse-passwd}
1578@findex tramp-parse-passwd
1579
1580A function which parses @file{/etc/passwd} like files. Obviously, it
1581can return user names only.
1582
1583@item @code{tramp-parse-netrc}
1584@findex tramp-parse-netrc
1585
ea3596a2
MA
1586Finally, a function which parses @file{~/.netrc} like files. This
1587includes also @file{~/.authinfo}-style files.
4009494e
GM
1588@end table
1589
1590If you want to keep your own data in a file, with your own structure,
1591you might provide such a function as well. This function must meet
1592the following conventions:
1593
1594@defun my-tramp-parse file
1595@var{file} must be either a file name on your host, or @code{nil}.
1596The function must return a list of (@var{user} @var{host}), which are
1597taken as candidates for user and host name completion.
1598
1599Example:
1600@example
1601(my-tramp-parse "~/.my-tramp-hosts")
1602
1603 @result{} ((nil "toto") ("daniel" "melancholia"))
1604@end example
1605@end defun
1606
1607
a06a4a12 1608@node Password handling
888a7fc0 1609@section Reusing passwords for several connections
4009494e
GM
1610@cindex passwords
1611
1612Sometimes it is necessary to connect to the same remote host several
1613times. Reentering passwords again and again would be annoying, when
1614the chosen method does not support access without password prompt
1615through own configuration.
1616
a06a4a12
MA
1617The best recommendation is to use the method's own mechanism for
1618password handling. Consider @command{ssh-agent} for @option{ssh}-like
1619methods, or @command{pageant} for @option{plink}-like methods.
1620
1621However, if you cannot apply such native password handling,
91af3942 1622@value{tramp} offers alternatives.
a06a4a12
MA
1623
1624
0e7b2867 1625@anchor{Using an authentication file}
a06a4a12
MA
1626@subsection Using an authentication file
1627
1628@vindex auth-sources
1629The package @file{auth-source.el}, originally developed in No Gnus,
1630offers the possibility to read passwords from a file, like FTP does it
1631from @file{~/.netrc}. The default authentication file is
1632@file{~/.authinfo.gpg}, this can be changed via the variable
1633@code{auth-sources}.
1634
1635@noindent
1636A typical entry in the authentication file would be
1637
1638@example
1639machine melancholia port scp login daniel password geheim
1640@end example
1641
1642The port can be any @value{tramp} method (@pxref{Inline methods},
193e6828
MA
1643@pxref{External methods}), to match only this method. When you omit
1644the port, you match all @value{tramp} methods.
a06a4a12 1645
ea3596a2
MA
1646In case of problems, setting @code{auth-source-debug} to @code{t}
1647gives useful debug messages.
1648
1649
0e7b2867 1650@anchor{Caching passwords}
a06a4a12
MA
1651@subsection Caching passwords
1652
1653If there is no authentication file, @value{tramp} caches the passwords
1654entered by you. They will be reused next time if a connection needs
1655them for the same user name and host name, independently of the
1656connection method.
4009494e
GM
1657
1658@vindex password-cache-expiry
1659Passwords are not saved permanently, that means the password caching
1660is limited to the lifetime of your @value{emacsname} session. You
1661can influence the lifetime of password caching by customizing the
1662variable @code{password-cache-expiry}. The value is the number of
1663seconds how long passwords are cached. Setting it to @code{nil}
1664disables the expiration.
1665
4009494e
GM
1666@vindex password-cache
1667If you don't like this feature for security reasons, password caching
1668can be disabled totally by customizing the variable
1669@code{password-cache} (setting it to @code{nil}).
1670
1671Implementation Note: password caching is based on the package
a06a4a12
MA
1672@file{password-cache.el}. For the time being, it is activated only
1673when this package is seen in the @code{load-path} while loading
4009494e
GM
1674@value{tramp}.
1675@ifset installchapter
1676If you don't use No Gnus, you can take @file{password.el} from the
1677@value{tramp} @file{contrib} directory, see @ref{Installation
1678parameters}.
1679@end ifset
4009494e
GM
1680
1681
1682@node Connection caching
888a7fc0 1683@section Reusing connection related information
4009494e
GM
1684@cindex caching
1685
1686@vindex tramp-persistency-file-name
1687In order to reduce initial connection time, @value{tramp} stores
1688connection related information persistently. The variable
1689@code{tramp-persistency-file-name} keeps the file name where these
1690information are written. Its default value is
1691@ifset emacs
1692@file{~/.emacs.d/tramp}.
1693@end ifset
1694@ifset xemacs
1695@file{~/.xemacs/tramp}.
1696@end ifset
1697It is recommended to choose a local file name.
1698
1699@value{tramp} reads this file during startup, and writes it when
1700exiting @value{emacsname}. You can simply remove this file if
1701@value{tramp} shall be urged to recompute these information next
1702@value{emacsname} startup time.
1703
1704Using such persistent information can be disabled by setting
1705@code{tramp-persistency-file-name} to @code{nil}.
1706
9bbb9638
MA
1707Once consequence of reusing connection related information is that
1708@var{tramp} needs to distinguish hosts. If you, for example, run a
1709local @code{sshd} on port 3001, which tunnels @command{ssh} to another
1710host, you could access both @file{@trampfn{ssh, , localhost,}} and
1711@file{@trampfn{ssh, , localhost#3001,}}. @var{tramp} would use the
1712same host related information (like paths, Perl variants, etc) for
1713both connections, although the information is valid only for one of
1714them.
1715
1716In order to avoid trouble, you must use another host name for one of
1717the connections, like introducing a @option{Host} section in
1718@file{~/.ssh/config} (@pxref{Frequently Asked Questions}) or applying
1719multiple hops (@pxref{Multi-hops}).
1720
bc5300d3
MA
1721When @value{tramp} detects a changed operating system version on a
1722remote host (via the command @command{uname -sr}), it flushes all
a06a4a12 1723connection related information for this host, and opens the
36539990 1724connection again.
bc5300d3 1725
4009494e
GM
1726
1727@node Remote Programs
888a7fc0 1728@section How @value{tramp} finds and uses programs on the remote machine
4009494e
GM
1729
1730@value{tramp} depends on a number of programs on the remote host in order to
1731function, including @command{ls}, @command{test}, @command{find} and
1732@command{cat}.
1733
1734In addition to these required tools, there are various tools that may be
1735required based on the connection method. See @ref{Inline methods} and
193e6828 1736@ref{External methods} for details on these.
4009494e
GM
1737
1738Certain other tools, such as @command{perl} (or @command{perl5}) and
1739@command{grep} will be used if they can be found. When they are
1740available, they are used to improve the performance and accuracy of
1741remote file access.
1742
1743@vindex tramp-remote-path
c0de5d04
MA
1744@vindex tramp-default-remote-path
1745@vindex tramp-own-remote-path
1746@defopt tramp-remote-path
4009494e
GM
1747When @value{tramp} connects to the remote machine, it searches for the
1748programs that it can use. The variable @code{tramp-remote-path}
1749controls the directories searched on the remote machine.
1750
1751By default, this is set to a reasonable set of defaults for most
1752machines. The symbol @code{tramp-default-remote-path} is a place
1753holder, it is replaced by the list of directories received via the
1754command @command{getconf PATH} on your remote machine. For example,
6e7fa8e2
MA
1755on Debian GNU/Linux this is @file{/bin:/usr/bin}, whereas on Solaris
1756this is @file{/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin}.
1757It is recommended to apply this symbol on top of
1758@code{tramp-remote-path}.
4009494e
GM
1759
1760It is possible, however, that your local (or remote ;) system
1761administrator has put the tools you want in some obscure local
1762directory.
1763
1764In this case, you can still use them with @value{tramp}. You simply
1765need to add code to your @file{.emacs} to add the directory to the
1766remote path. This will then be searched by @value{tramp} when you
1767connect and the software found.
1768
1769To add a directory to the remote search path, you could use code such
1770as:
1771
1772@lisp
1773@i{;; We load @value{tramp} to define the variable.}
1774(require 'tramp)
1775@i{;; We have @command{perl} in "/usr/local/perl/bin"}
1776(add-to-list 'tramp-remote-path "/usr/local/perl/bin")
1777@end lisp
1778
c0de5d04 1779Another possibility is to reuse the path settings of your remote
36539990 1780account when you log in. Usually, these settings are overwritten,
c0de5d04
MA
1781because they might not be useful for @value{tramp}. The place holder
1782@code{tramp-own-remote-path} preserves these settings. You can
1783activate it via
1784
1785@lisp
1786(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
1787@end lisp
1788@end defopt
1789
4009494e
GM
1790@value{tramp} caches several information, like the Perl binary
1791location. The changed remote search path wouldn't affect these
1792settings. In order to force @value{tramp} to recompute these values,
1793you must exit @value{emacsname}, remove your persistency file
1794(@pxref{Connection caching}), and restart @value{emacsname}.
1795
1796
1797@node Remote shell setup
4009494e
GM
1798@section Remote shell setup hints
1799@cindex remote shell setup
1800@cindex @file{.profile} file
1801@cindex @file{.login} file
1802@cindex shell init files
1803
1804As explained in the @ref{Overview} section, @value{tramp} connects to the
1805remote host and talks to the shell it finds there. Of course, when you
1806log in, the shell executes its init files. Suppose your init file
1807requires you to enter the birth date of your mother; clearly @value{tramp}
1808does not know this and hence fails to log you in to that host.
1809
1810There are different possible strategies for pursuing this problem. One
1811strategy is to enable @value{tramp} to deal with all possible situations.
1812This is a losing battle, since it is not possible to deal with
1813@emph{all} situations. The other strategy is to require you to set up
1814the remote host such that it behaves like @value{tramp} expects. This might
1815be inconvenient because you have to invest a lot of effort into shell
1816setup before you can begin to use @value{tramp}.
1817
1818The package, therefore, pursues a combined approach. It tries to
1819figure out some of the more common setups, and only requires you to
1820avoid really exotic stuff. For example, it looks through a list of
1821directories to find some programs on the remote host. And also, it
1822knows that it is not obvious how to check whether a file exists, and
1823therefore it tries different possibilities. (On some hosts and
1824shells, the command @command{test -e} does the trick, on some hosts
1825the shell builtin doesn't work but the program @command{/usr/bin/test
1826-e} or @command{/bin/test -e} works. And on still other hosts,
1827@command{ls -d} is the right way to do this.)
1828
1829Below you find a discussion of a few things that @value{tramp} does not deal
1830with, and that you therefore have to set up correctly.
1831
1832@table @asis
1833@item @var{shell-prompt-pattern}
1834@vindex shell-prompt-pattern
1835
1836After logging in to the remote host, @value{tramp} has to wait for the remote
1837shell startup to finish before it can send commands to the remote
1838shell. The strategy here is to wait for the shell prompt. In order to
1839recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1840to be set correctly to recognize the shell prompt on the remote host.
1841
1842Note that @value{tramp} requires the match for @code{shell-prompt-pattern}
1843to be at the end of the buffer. Many people have something like the
1844following as the value for the variable: @code{"^[^>$][>$] *"}. Now
1845suppose your shell prompt is @code{a <b> c $ }. In this case,
1846@value{tramp} recognizes the @code{>} character as the end of the prompt,
1847but it is not at the end of the buffer.
1848
1849@item @var{tramp-shell-prompt-pattern}
1850@vindex tramp-shell-prompt-pattern
1851
1852This regular expression is used by @value{tramp} in the same way as
1853@code{shell-prompt-pattern}, to match prompts from the remote shell.
1854This second variable exists because the prompt from the remote shell
1855might be different from the prompt from a local shell --- after all,
1856the whole point of @value{tramp} is to log in to remote hosts as a
1857different user. The default value of
1858@code{tramp-shell-prompt-pattern} is the same as the default value of
1859@code{shell-prompt-pattern}, which is reported to work well in many
1860circumstances.
1861
dd753688
MA
1862@item @var{tramp-password-prompt-regexp}
1863@vindex tramp-password-prompt-regexp
1864@vindex tramp-wrong-passwd-regexp
1865
1866During login, @value{tramp} might be forced to enter a password or a
1867passphrase. The difference between both is that a password is
1868requested from the shell on the remote host, while a passphrase is
1869needed for accessing local authentication information, like your ssh
1870key.
1871
1872@var{tramp-password-prompt-regexp} handles the detection of such
1873requests for English environments. When you use another localization
1874of your (local or remote) host, you might need to adapt this. Example:
1875
1876@lisp
1877(setq
1878 tramp-password-prompt-regexp
1879 (concat
1880 "^.*"
1881 (regexp-opt
1882 '("passphrase" "Passphrase"
1883 ;; English
1884 "password" "Password"
1885 ;; Deutsch
1886 "passwort" "Passwort"
1887 ;; Fran@,{c}ais
1888 "mot de passe" "Mot de passe") t)
1889 ".*:\0? *"))
1890@end lisp
1891
1892In parallel, it might also be necessary to adapt
1893@var{tramp-wrong-passwd-regexp}.
1894
4009494e
GM
1895@item @command{tset} and other questions
1896@cindex Unix command tset
1897@cindex tset Unix command
1898
1899Some people invoke the @command{tset} program from their shell startup
1900scripts which asks the user about the terminal type of the shell.
1901Maybe some shells ask other questions when they are started.
1902@value{tramp} does not know how to answer these questions. There are
1903two approaches for dealing with this problem. One approach is to take
1904care that the shell does not ask any questions when invoked from
888a7fc0 1905@value{tramp}. You can do this by checking the @env{TERM}
4009494e
GM
1906environment variable, it will be set to @code{dumb} when connecting.
1907
1908@vindex tramp-terminal-type
1909The variable @code{tramp-terminal-type} can be used to change this value
1910to @code{dumb}.
1911
1912@vindex tramp-actions-before-shell
1913The other approach is to teach @value{tramp} about these questions. See
1914the variable @code{tramp-actions-before-shell}. Example:
1915
1916@lisp
1917(defconst my-tramp-prompt-regexp
1918 (concat (regexp-opt '("Enter the birth date of your mother:") t)
1919 "\\s-*")
1920 "Regular expression matching my login prompt question.")
1921
1922(defun my-tramp-action (proc vec)
1923 "Enter \"19000101\" in order to give a correct answer."
1924 (save-window-excursion
1925 (with-current-buffer (tramp-get-connection-buffer vec)
1926 (tramp-message vec 6 "\n%s" (buffer-string))
1927 (tramp-send-string vec "19000101"))))
1928
1929(add-to-list 'tramp-actions-before-shell
1930 '(my-tramp-prompt-regexp my-tramp-action))
1931@end lisp
1932
1933
1934@item Environment variables named like users in @file{.profile}
1935
888a7fc0 1936If you have a user named frumple and set the variable @env{FRUMPLE} in
4009494e 1937your shell environment, then this might cause trouble. Maybe rename
888a7fc0 1938the variable to @env{FRUMPLE_DIR} or the like.
4009494e
GM
1939
1940This weird effect was actually reported by a @value{tramp} user!
1941
1942
1943@item Non-Bourne commands in @file{.profile}
1944
1945After logging in to the remote host, @value{tramp} issues the command
1946@command{exec /bin/sh}. (Actually, the command is slightly
1947different.) When @command{/bin/sh} is executed, it reads some init
1948files, such as @file{~/.shrc} or @file{~/.profile}.
1949
1950Now, some people have a login shell which is not @code{/bin/sh} but a
1951Bourne-ish shell such as bash or ksh. Some of these people might put
1952their shell setup into the files @file{~/.shrc} or @file{~/.profile}.
1953This way, it is possible for non-Bourne constructs to end up in those
1954files. Then, @command{exec /bin/sh} might cause the Bourne shell to
1955barf on those constructs.
1956
1957As an example, imagine somebody putting @command{export FOO=bar} into
1958the file @file{~/.profile}. The standard Bourne shell does not
1959understand this syntax and will emit a syntax error when it reaches
1960this line.
1961
1962Another example is the tilde (@code{~}) character, say when adding
888a7fc0 1963@file{~/bin} to @env{PATH}. Many Bourne shells will not expand this
4009494e
GM
1964character, and since there is usually no directory whose name consists
1965of the single character tilde, strange things will happen.
1966
1967What can you do about this?
1968
1969Well, one possibility is to make sure that everything in
1970@file{~/.shrc} and @file{~/.profile} on all remote hosts is
1971Bourne-compatible. In the above example, instead of @command{export
1972FOO=bar}, you might use @command{FOO=bar; export FOO} instead.
1973
1974The other possibility is to put your non-Bourne shell setup into some
1975other files. For example, bash reads the file @file{~/.bash_profile}
1976instead of @file{~/.profile}, if the former exists. So bash
1977aficionados just rename their @file{~/.profile} to
1978@file{~/.bash_profile} on all remote hosts, and Bob's your uncle.
1979
1980The @value{tramp} developers would like to circumvent this problem, so
1981if you have an idea about it, please tell us. However, we are afraid
1982it is not that simple: before saying @command{exec /bin/sh},
1983@value{tramp} does not know which kind of shell it might be talking
1984to. It could be a Bourne-ish shell like ksh or bash, or it could be a
1985csh derivative like tcsh, or it could be zsh, or even rc. If the
1986shell is Bourne-ish already, then it might be prudent to omit the
1987@command{exec /bin/sh} step. But how to find out if the shell is
1988Bourne-ish?
1989
36bc5d3b
MA
1990
1991@item Interactive shell prompt
1992
1993@value{tramp} redefines the shell prompt in order to parse the shell's
1994output robustly. When calling an interactive shell by @kbd{M-x
1995shell}, this doesn't look nice.
1996
1997You can redefine the shell prompt by checking the environment variable
888a7fc0
MA
1998@env{INSIDE_EMACS}, which is set by @value{tramp}, in your startup
1999script @file{~/.emacs_SHELLNAME}. @env{SHELLNAME} might be the string
36bc5d3b 2000@code{bash} or similar, in case of doubt you could set it the
888a7fc0 2001environment variable @env{ESHELL} in your @file{.emacs}:
36bc5d3b
MA
2002
2003@lisp
2004(setenv "ESHELL" "bash")
2005@end lisp
2006
2007Your file @file{~/.emacs_SHELLNAME} could contain code like
2008
2009@example
2010# Reset the prompt for remote Tramp shells.
2011if [ "$@{INSIDE_EMACS/*tramp*/tramp@}" == "tramp" ] ; then
2012 PS1="[\u@@\h \w]$ "
2013fi
2014@end example
2015
2016@ifinfo
2017@ifset emacs
2018@xref{Interactive Shell, , , @value{emacsdir}}.
2019@end ifset
2020@end ifinfo
2021
4009494e
GM
2022@end table
2023
2024
2025@node Auto-save and Backup
2026@section Auto-save and Backup configuration
2027@cindex auto-save
2028@cindex backup
2029@ifset emacs
2030@vindex backup-directory-alist
2031@end ifset
2032@ifset xemacs
2033@vindex bkup-backup-directory-info
2034@end ifset
2035
2036Normally, @value{emacsname} writes backup files to the same directory
2037as the original files, but this behavior can be changed via the
2038variable
2039@ifset emacs
2040@code{backup-directory-alist}.
2041@end ifset
2042@ifset xemacs
2043@code{bkup-backup-directory-info}.
2044@end ifset
2045In connection with @value{tramp}, this can have unexpected side
2046effects. Suppose that you specify that all backups should go to the
2047directory @file{~/.emacs.d/backups/}, and then you edit the file
2048@file{@trampfn{su, root, localhost, /etc/secretfile}}. The effect is
2049that the backup file will be owned by you and not by root, thus
2050possibly enabling others to see it even if they were not intended to
2051see it.
2052
2053When
2054@ifset emacs
2055@code{backup-directory-alist}
2056@end ifset
2057@ifset xemacs
2058@code{bkup-backup-directory-info}
2059@end ifset
2060is @code{nil} (the default), such problems do not occur.
2061
2062Therefore, it is useful to set special values for @value{tramp}
2063files. For example, the following statement effectively `turns off'
2064the effect of
2065@ifset emacs
2066@code{backup-directory-alist}
2067@end ifset
2068@ifset xemacs
2069@code{bkup-backup-directory-info}
2070@end ifset
2071for @value{tramp} files:
2072
2073@ifset emacs
2074@lisp
2075(add-to-list 'backup-directory-alist
2076 (cons tramp-file-name-regexp nil))
2077@end lisp
2078@end ifset
2079@ifset xemacs
2080@lisp
2081(require 'backup-dir)
2082(add-to-list 'bkup-backup-directory-info
2083 (list tramp-file-name-regexp ""))
2084@end lisp
2085@end ifset
2086
c7bd4ebe
MA
2087@ifset emacs
2088It is also possible to disable backups depending on the used method.
2089The following code disables backups for the @option{su} and
2090@option{sudo} methods:
2091
2092@lisp
2093(setq backup-enable-predicate
2094 (lambda (name)
2095 (and (normal-backup-enable-predicate name)
2096 (not
2097 (let ((method (file-remote-p name 'method)))
2098 (when (stringp method)
2099 (member method '("su" "sudo"))))))))
2100@end lisp
2101@end ifset
2102
2103
4009494e
GM
2104Another possibility is to use the @value{tramp} variable
2105@ifset emacs
2106@code{tramp-backup-directory-alist}.
2107@end ifset
2108@ifset xemacs
2109@code{tramp-bkup-backup-directory-info}.
2110@end ifset
2111This variable has the same meaning like
2112@ifset emacs
2113@code{backup-directory-alist}.
2114@end ifset
2115@ifset xemacs
2116@code{bkup-backup-directory-info}.
2117@end ifset
2118If a @value{tramp} file is backed up, and DIRECTORY is an absolute
2119local file name, DIRECTORY is prepended with the @value{tramp} file
2120name prefix of the file to be backed up.
2121
2122@noindent
2123Example:
2124
2125@ifset emacs
2126@lisp
2127(add-to-list 'backup-directory-alist
2128 (cons "." "~/.emacs.d/backups/"))
2129(setq tramp-backup-directory-alist backup-directory-alist)
2130@end lisp
2131@end ifset
2132@ifset xemacs
2133@lisp
2134(require 'backup-dir)
2135(add-to-list 'bkup-backup-directory-info
2136 (list "." "~/.emacs.d/backups/" 'full-path))
2137(setq tramp-bkup-backup-directory-info bkup-backup-directory-info)
2138@end lisp
2139@end ifset
2140
2141@noindent
2142The backup file name of @file{@trampfn{su, root, localhost,
2143/etc/secretfile}} would be
2144@ifset emacs
2145@file{@trampfn{su, root, localhost,
2146~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile~}}
2147@end ifset
2148@ifset xemacs
2149@file{@trampfn{su, root, localhost,
2150~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}}
2151@end ifset
2152
2153The same problem can happen with auto-saving files.
2154@ifset emacs
456b348e
MA
2155The variable @code{auto-save-file-name-transforms} keeps information,
2156on which directory an auto-saved file should go. By default, it is
2157initialized for @value{tramp} files to the local temporary directory.
4009494e
GM
2158
2159On some versions of @value{emacsname}, namely the version built for
2160Debian GNU/Linux, the variable @code{auto-save-file-name-transforms}
2161contains the directory where @value{emacsname} was built. A
2162workaround is to manually set the variable to a sane value.
2163
2164If auto-saved files should go into the same directory as the original
2165files, @code{auto-save-file-name-transforms} should be set to @code{nil}.
2166
2167Another possibility is to set the variable
2168@code{tramp-auto-save-directory} to a proper value.
2169@end ifset
2170@ifset xemacs
2171For this purpose you can set the variable @code{auto-save-directory}
2172to a proper value.
2173@end ifset
2174
2175
2176@node Windows setup hints
2177@section Issues with Cygwin ssh
2178@cindex Cygwin, issues
2179
2180This section needs a lot of work! Please help.
2181
2182@cindex method sshx with Cygwin
2183@cindex sshx method with Cygwin
2184The recent Cygwin installation of @command{ssh} works only with a
2185Cygwinized @value{emacsname}. You can check it by typing @kbd{M-x
2186eshell}, and starting @kbd{ssh test.machine}. The problem is evident
2187if you see a message like this:
2188
2189@example
2190Pseudo-terminal will not be allocated because stdin is not a terminal.
2191@end example
2192
2193Older @command{ssh} versions of Cygwin are told to cooperate with
2194@value{tramp} selecting @option{sshx} as the connection method. You
2195can find information about setting up Cygwin in their FAQ at
2196@uref{http://cygwin.com/faq/}.
2197
2198@cindex method scpx with Cygwin
2199@cindex scpx method with Cygwin
2200If you wish to use the @option{scpx} connection method, then you might
2201have the problem that @value{emacsname} calls @command{scp} with a
2202Windows filename such as @code{c:/foo}. The Cygwin version of
2203@command{scp} does not know about Windows filenames and interprets
2204this as a remote filename on the host @code{c}.
2205
2206One possible workaround is to write a wrapper script for @option{scp}
2207which converts the Windows filename to a Cygwinized filename.
2208
2209@cindex Cygwin and ssh-agent
2210@cindex SSH_AUTH_SOCK and @value{emacsname} on Windows
2211If you want to use either @option{ssh} based method on Windows, then
2212you might encounter problems with @command{ssh-agent}. Using this
2213program, you can avoid typing the pass-phrase every time you log in.
2214However, if you start @value{emacsname} from a desktop shortcut, then
888a7fc0 2215the environment variable @env{SSH_AUTH_SOCK} is not set and so
4009494e
GM
2216@value{emacsname} and thus @value{tramp} and thus @command{ssh} and
2217@command{scp} started from @value{tramp} cannot communicate with
2218@command{ssh-agent}. It works better to start @value{emacsname} from
2219the shell.
2220
2221If anyone knows how to start @command{ssh-agent} under Windows in such a
2222way that desktop shortcuts can profit, please holler. I don't really
2223know anything at all about Windows@dots{}
2224
2225
2226@node Usage
2227@chapter Using @value{tramp}
2228@cindex using @value{tramp}
2229
2230Once you have installed @value{tramp} it will operate fairly
2231transparently. You will be able to access files on any remote machine
2232that you can log in to as though they were local.
2233
2234Files are specified to @value{tramp} using a formalized syntax specifying the
2235details of the system to connect to. This is similar to the syntax used
2236by the @value{ftppackagename} package.
2237
2238@cindex type-ahead
2239Something that might happen which surprises you is that
2240@value{emacsname} remembers all your keystrokes, so if you see a
2241password prompt from @value{emacsname}, say, and hit @kbd{@key{RET}}
2242twice instead of once, then the second keystroke will be processed by
2243@value{emacsname} after @value{tramp} has done its thing. Why, this
2244type-ahead is normal behavior, you say. Right you are, but be aware
2245that opening a remote file might take quite a while, maybe half a
2246minute when a connection needs to be opened. Maybe after half a
2247minute you have already forgotten that you hit that key!
2248
2249@menu
2250* Filename Syntax:: @value{tramp} filename conventions.
2251* Alternative Syntax:: URL-like filename syntax.
2252* Filename completion:: Filename completion.
888a7fc0 2253* Ad-hoc multi-hops:: Declaring multiple hops in the file name.
4009494e 2254* Remote processes:: Integration with other @value{emacsname} packages.
dd753688 2255* Cleanup remote connections:: Cleanup remote connections.
4009494e
GM
2256@end menu
2257
2258
2259@node Filename Syntax
2260@section @value{tramp} filename conventions
2261@cindex filename syntax
2262@cindex filename examples
2263
2264To access the file @var{localname} on the remote machine @var{machine}
2265you would specify the filename @file{@trampfn{, , machine,
2266localname}}. This will connect to @var{machine} and transfer the file
2267using the default method. @xref{Default Method}.
2268
2269Some examples of @value{tramp} filenames are shown below.
2270
2271@table @file
2272@item @trampfn{, , melancholia, .emacs}
2273Edit the file @file{.emacs} in your home directory on the machine
2274@code{melancholia}.
2275
2276@item @trampfn{, , melancholia.danann.net, .emacs}
2277This edits the same file, using the fully qualified domain name of
2278the machine.
2279
2280@item @trampfn{, , melancholia, ~/.emacs}
2281This also edits the same file --- the @file{~} is expanded to your
2282home directory on the remote machine, just like it is locally.
2283
2284@item @trampfn{, , melancholia, ~daniel/.emacs}
2285This edits the file @file{.emacs} in the home directory of the user
2286@code{daniel} on the machine @code{melancholia}. The @file{~<user>}
2287construct is expanded to the home directory of that user on the remote
2288machine.
2289
2290@item @trampfn{, , melancholia, /etc/squid.conf}
2291This edits the file @file{/etc/squid.conf} on the machine
2292@code{melancholia}.
2293
2294@end table
2295
4a0cf14f
MA
2296@var{machine} can also be an IPv4 or IPv6 address, like in
2297@file{@trampfn{, , 127.0.0.1, .emacs}} or @file{@trampfn{, ,
2298@value{ipv6prefix}::1@value{ipv6postfix}, .emacs}}.
2299@ifset emacs
2300For syntactical reasons, IPv6 addresses must be embedded in square
2301brackets @file{@value{ipv6prefix}} and @file{@value{ipv6postfix}}.
2302@end ifset
2303
4009494e
GM
2304Unless you specify a different name to use, @value{tramp} will use the
2305current local user name as the remote user name to log in with. If you
2306need to log in as a different user, you can specify the user name as
2307part of the filename.
2308
2309To log in to the remote machine as a specific user, you use the syntax
2310@file{@trampfn{, user, machine, path/to.file}}. That means that
2311connecting to @code{melancholia} as @code{daniel} and editing
2312@file{.emacs} in your home directory you would specify
2313@file{@trampfn{, daniel, melancholia, .emacs}}.
2314
2315It is also possible to specify other file transfer methods
193e6828
MA
2316(@pxref{Inline methods}, @pxref{External methods}) as part of the
2317filename.
4009494e
GM
2318@ifset emacs
2319This is done by putting the method before the user and host name, as
2320in @file{@value{prefix}@var{method}@value{postfixhop}} (Note the
2321trailing colon).
2322@end ifset
2323@ifset xemacs
2324This is done by replacing the initial @file{@value{prefix}} with
2325@file{@value{prefix}<method>@value{postfixhop}}. (Note the trailing
2326slash!).
2327@end ifset
2328The user, machine and file specification remain the same.
2329
2330So, to connect to the machine @code{melancholia} as @code{daniel},
2331using the @option{ssh} method to transfer files, and edit
2332@file{.emacs} in my home directory I would specify the filename
2333@file{@trampfn{ssh, daniel, melancholia, .emacs}}.
2334
ca1bb391
MA
2335Finally, for some methods it is possible to specify a different port
2336number than the default one, given by the method. This is specified
2337by adding @file{#<port>} to the host name, like in @file{@trampfn{ssh,
2338daniel, melancholia#42, .emacs}}.
2339
4009494e
GM
2340
2341@node Alternative Syntax
2342@section URL-like filename syntax
2343@cindex filename syntax
2344@cindex filename examples
2345
2346Additionally to the syntax described in the previous chapter, it is
2347possible to use a URL-like syntax for @value{tramp}. This can be
2348switched on by customizing the variable @code{tramp-syntax}. Please
2349note that this feature is experimental for the time being.
2350
2351The variable @code{tramp-syntax} must be set before requiring @value{tramp}:
2352
2353@lisp
2354(setq tramp-syntax 'url)
2355(require 'tramp)
2356@end lisp
2357
2358Then, a @value{tramp} filename would look like this:
2359@file{/@var{method}://@var{user}@@@var{machine}:@var{port}/@var{path/to.file}}.
2360@file{/@var{method}://} is mandatory, all other parts are optional.
2361@file{:@var{port}} is useful for methods only who support this.
2362
2363The last example from the previous section would look like this:
2364@file{/ssh://daniel@@melancholia/.emacs}.
2365
2366For the time being, @code{tramp-syntax} can have the following values:
2367
2368@itemize @w{}
2369@ifset emacs
2370@item @code{ftp} -- That is the default syntax
2371@item @code{url} -- URL-like syntax
2372@end ifset
2373@ifset xemacs
2374@item @code{sep} -- That is the default syntax
2375@item @code{url} -- URL-like syntax
2376@item @code{ftp} -- EFS-like syntax
2377@end ifset
2378@end itemize
2379
2380
2381@node Filename completion
2382@section Filename completion
2383@cindex filename completion
2384
2385Filename completion works with @value{tramp} for completion of method
2386names, of user names and of machine names as well as for completion of
2387file names on remote machines.
2388@ifset emacs
b59329e0
MA
2389In order to enable this, partial completion must be activated in your
2390@file{.emacs}.
4009494e
GM
2391@ifinfo
2392@xref{Completion Options, , , @value{emacsdir}}.
2393@end ifinfo
2394@end ifset
2395
2396If you, for example, type @kbd{C-x C-f @value{prefix}t
2397@key{TAB}}, @value{tramp} might give you as result the choice for
2398
2399@example
4a0cf14f 2400@multitable {@trampfn{telnet, , melancholia.danann.net,}} {@trampfn{telnet, , 192.168.0.1,}}
4009494e 2401@ifset emacs
4a0cf14f
MA
2402@item @value{prefixhop}telnet@value{postfixhop} @tab tmp/
2403@item @value{prefixhop}toto@value{postfix} @tab
4009494e
GM
2404@end ifset
2405@ifset xemacs
4a0cf14f 2406@item @value{prefixhop}telnet@value{postfixhop} @tab @value{prefixhop}toto@value{postfix}
4009494e 2407@end ifset
4a0cf14f 2408@end multitable
4009494e
GM
2409@end example
2410
2411@samp{@value{prefixhop}telnet@value{postfixhop}}
2412is a possible completion for the respective method,
2413@ifset emacs
2414@samp{tmp/} stands for the directory @file{/tmp} on your local
2415machine,
2416@end ifset
2417and @samp{@value{prefixhop}toto@value{postfix}}
2418might be a host @value{tramp} has detected in your @file{~/.ssh/known_hosts}
2419file (given you're using default method @option{ssh}).
2420
2421If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
2422@samp{@value{prefix}telnet@value{postfixhop}}.
2423Next @kbd{@key{TAB}} brings you all machine names @value{tramp} detects in
2424your @file{/etc/hosts} file, let's say
2425
2426@example
4a0cf14f
MA
2427@multitable {@trampfn{telnet, , melancholia.danann.net,}} {@trampfn{telnet, , 192.168.0.1,}}
2428@item @trampfn{telnet, , 127.0.0.1,} @tab @trampfn{telnet, , 192.168.0.1,}
2429@item @trampfn{telnet, , @value{ipv6prefix}::1@value{ipv6postfix},} @tab @trampfn{telnet, , localhost,}
2430@item @trampfn{telnet, , melancholia.danann.net,} @tab @trampfn{telnet, , melancholia,}
2431@end multitable
4009494e
GM
2432@end example
2433
2434Now you can choose the desired machine, and you can continue to
2435complete file names on that machine.
2436
2437If the configuration files (@pxref{Customizing Completion}), which
2438@value{tramp} uses for analysis of completion, offer user names, those user
2439names will be taken into account as well.
2440
36539990
MA
2441Remote machines which have been visited in the past and kept
2442persistently (@pxref{Connection caching}) will be offered too.
4009494e
GM
2443
2444Once the remote machine identification is completed, it comes to
2445filename completion on the remote host. This works pretty much like
2446for files on the local host, with the exception that minibuffer
2447killing via a double-slash works only on the filename part, except
2448that filename part starts with @file{//}.
b048d478 2449@ifset emacs
fffa137c 2450A triple-slash stands for the default behavior.
b048d478 2451@end ifset
4009494e
GM
2452@ifinfo
2453@xref{Minibuffer File, , , @value{emacsdir}}.
2454@end ifinfo
2455
b048d478
MA
2456@noindent
2457Example:
2458
2459@example
4009494e 2460@ifset emacs
b048d478
MA
2461@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//etc} @key{TAB}}
2462 @print{} @trampfn{telnet, , melancholia, /etc}
2463
2464@kbd{C-x C-f @trampfn{telnet, , melancholia, //etc} @key{TAB}}
2465 @print{} /etc
2466
2467@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin///etc} @key{TAB}}
2468 @print{} /etc
4009494e
GM
2469@end ifset
2470
2471@ifset xemacs
b048d478
MA
2472@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//}}
2473 @print{} @trampfn{telnet, , melancholia, /}
2474
2475@kbd{C-x C-f @trampfn{telnet, , melancholia, //}}
2476 @print{} /
4009494e 2477@end ifset
b048d478
MA
2478@end example
2479
2480A remote directory might have changed its contents out of
2481@value{emacsname} control, for example by creation or deletion of
36539990
MA
2482files by other processes. Therefore, during filename completion, the
2483remote directory contents are reread regularly in order to detect such
b048d478
MA
2484changes, which would be invisible otherwise (@pxref{Connection caching}).
2485
2486@defopt tramp-completion-reread-directory-timeout
2487This variable defines the number of seconds since last remote command
2488before rereading a directory contents. A value of 0 would require an
2489immediate reread during filename completion, @code{nil} means to use
2490always cached values for the directory contents.
2491@end defopt
4009494e
GM
2492
2493
888a7fc0
MA
2494@node Ad-hoc multi-hops
2495@section Declaring multiple hops in the file name
2496@cindex multi-hop, ad-hoc
2497@cindex proxy hosts, ad-hoc
2498
2499Multiple hops are configured with the variable
2500@code{tramp-default-proxies-alist} (@pxref{Multi-hops}). However,
2501sometimes it is desirable to reach a remote host immediately, without
2502configuration changes. This can be reached by an ad-hoc specification
2503of the proxies.
2504
2505A proxy looks like a remote file name specification without the local
2506file name part. It is prepended to the target remote file name,
2507separated by @samp{|}. As an example, a remote file on
2508@samp{you@@remotehost}, passing the proxy @samp{bird@@bastion}, could
2509be opened by
2510
2511@example
2512@c @kbd{C-x C-f @trampfn{ssh@value{postfixhop}bird@@bastion|ssh, you,
2513@c remotehost, /path}}
2514@kbd{C-x C-f @value{prefix}ssh@value{postfixhop}bird@@bastion|ssh@value{postfixhop}you@@remotehost@value{postfix}/path}
2515@end example
2516
2517Multiple hops can be cascaded, separating all proxies by @samp{|}.
2518The proxies can also contain the patterns @code{%h} or @code{%u}.
2519
2520The ad-hoc definition is added on the fly to
2521@code{tramp-default-proxies-alist}. Therefore, during the lifetime of
2522the @value{emacsname} session it is not necessary to enter this ad-hoc
2523specification, again. The remote file name @samp{@trampfn{ssh, you,
2524remotehost, /path}} would be sufficient from now on.
2525
2526@vindex tramp-save-ad-hoc-proxies
2527@defopt tramp-save-ad-hoc-proxies
2528This customer option controls whether ad-hoc definitions are kept
2529persistently in @code{tramp-default-proxies-alist}. That means, those
2530definitions are available also for future @value{emacsname} sessions.
2531@end defopt
2532
2533
4009494e 2534@node Remote processes
888a7fc0 2535@section Integration with other @value{emacsname} packages
4009494e
GM
2536@cindex compile
2537@cindex recompile
2538
2539@value{tramp} supports running processes on a remote host. This
2540allows to exploit @value{emacsname} packages without modification for
888a7fc0
MA
2541remote file names. It does not work for the @option{ftp} method.
2542Association of a pty, as specified in @code{start-file-process}, is
2543not supported.
4009494e 2544
305bdd22 2545@code{process-file} and @code{start-file-process} work on the remote
36539990 2546host when the variable @code{default-directory} is remote:
305bdd22
MA
2547
2548@lisp
2549(let ((default-directory "/ssh:remote.host:"))
2550 (start-file-process "grep" (get-buffer-create "*grep*")
2551 "/bin/sh" "-c" "grep -e tramp *"))
2552@end lisp
2553
88a683c5
MA
2554@ifset emacsgvfs
2555If the remote host is mounted via GVFS (see @ref{GVFS based methods}),
2556the remote filesystem is mounted locally. Therefore, there are no
2557remote processes; all processes run still locally on your machine with
2558an adapted @code{default-directory}. This section does not apply for
2559such connection methods.
2560@end ifset
2561
4009494e
GM
2562Remote processes are started when a corresponding command is executed
2563from a buffer belonging to a remote file or directory. Up to now, the
2564packages @file{compile.el} (commands like @code{compile} and
2565@code{grep}) and @file{gud.el} (@code{gdb} or @code{perldb}) have been
2566integrated. Integration of further packages is planned, any help for
2567this is welcome!
2568
2569When your program is not found in the default search path
2570@value{tramp} sets on the remote machine, you should either use an
2571absolute path, or extend @code{tramp-remote-path} (see @ref{Remote
2572Programs}):
2573
2574@lisp
2575(add-to-list 'tramp-remote-path "~/bin")
2576(add-to-list 'tramp-remote-path "/appli/pub/bin")
2577@end lisp
2578
2579The environment for your program can be adapted by customizing
2580@code{tramp-remote-process-environment}. This variable is a list of
2581strings. It is structured like @code{process-environment}. Each
888a7fc0
MA
2582element is a string of the form @code{"ENVVARNAME=VALUE"}. An entry
2583@code{"ENVVARNAME="} disables the corresponding environment variable,
2584which might have been set in your init file like @file{~/.profile}.
4009494e
GM
2585
2586@noindent
2587Adding an entry can be performed via @code{add-to-list}:
2588
2589@lisp
2590(add-to-list 'tramp-remote-process-environment "JAVA_HOME=/opt/java")
2591@end lisp
2592
2593Changing or removing an existing entry is not encouraged. The default
2594values are chosen for proper @value{tramp} work. Nevertheless, if for
2595example a paranoid system administrator disallows changing the
888a7fc0 2596@env{HISTORY} environment variable, you can customize
4009494e
GM
2597@code{tramp-remote-process-environment}, or you can apply the
2598following code in your @file{.emacs}:
2599
2600@lisp
2601(let ((process-environment tramp-remote-process-environment))
2602 (setenv "HISTORY" nil)
2603 (setq tramp-remote-process-environment process-environment))
2604@end lisp
2605
2606If you use other @value{emacsname} packages which do not run
2607out-of-the-box on a remote host, please let us know. We will try to
2608integrate them as well. @xref{Bug Reports}.
2609
2610
c0de5d04
MA
2611@subsection Running remote programs that create local X11 windows
2612
2613If you want to run a remote program, which shall connect the X11
2614server you are using with your local host, you can set the
888a7fc0 2615@env{DISPLAY} environment variable on the remote host:
c0de5d04
MA
2616
2617@lisp
2618(add-to-list 'tramp-remote-process-environment
2619 (format "DISPLAY=%s" (getenv "DISPLAY")))
2620@end lisp
2621
2622@noindent
2623@code{(getenv "DISPLAY")} shall return a string containing a host
2624name, which can be interpreted on the remote host; otherwise you might
2625use a fixed host name. Strings like @code{:0} cannot be used properly
2626on the remote host.
2627
2628Another trick might be that you put @code{ForwardX11 yes} or
2629@code{ForwardX11Trusted yes} to your @file{~/.ssh/config} file for
2630that host.
2631
2632
e756ec02
MA
2633@subsection Running @code{shell} on a remote host
2634@cindex shell
2635
888a7fc0 2636Calling @kbd{M-x shell} in a buffer related to a remote host runs the
e756ec02
MA
2637local shell as defined in @option{shell-file-name}. This might be
2638also a valid path name for a shell to be applied on the remote host,
2639but it will fail at least when your local and remote hosts belong to
2640different system types, like @samp{windows-nt} and @samp{gnu/linux}.
2641
2642You must set the variable @option{explicit-shell-file-name} to the
2643shell path name on the remote host, in order to start that shell on
2644the remote host.
2645
2646@ifset emacs
2647Starting with Emacs 24 this won't be necessary, if you call
2648@code{shell} interactively. You will be asked for the remote shell
2649path, if you are on a remote buffer, and if
2650@option{explicit-shell-file-name} is equal to @code{nil}.
2651@end ifset
2652
2653
2654@subsection Running @code{shell-command} on a remote host
f18ce50c
MA
2655@cindex shell-command
2656
2657@code{shell-command} allows to execute commands in a shell, either
2658synchronously, either asynchronously. This works also on remote
2659hosts. Example:
2660
2661@example
2662@kbd{C-x C-f @trampfn{sudo, , , } @key{RET}}
2663@kbd{M-! tail -f /var/log/syslog.log & @key{RET}}
2664@end example
2665
2666You will see the buffer @file{*Async Shell Command*}, containing the
16c3428a 2667continuous output of the @command{tail} command.
f18ce50c 2668
888a7fc0
MA
2669@ifset emacs
2670A similar behaviour can be reached by @kbd{M-x auto-revert-tail-mode},
2671if available.
2672@end ifset
2673
f18ce50c 2674
e756ec02 2675@subsection Running @code{eshell} on a remote host
4009494e
GM
2676@cindex eshell
2677
2678@value{tramp} is integrated into @file{eshell.el}. That is, you can
2679open an interactive shell on your remote host, and run commands there.
888a7fc0 2680After you have started @kbd{M-x eshell}, you could perform commands
e756ec02 2681like this:
4009494e
GM
2682
2683@example
2684@b{~ $} cd @trampfn{sudo, , , /etc} @key{RET}
2685@b{@trampfn{sudo, root, host, /etc} $} hostname @key{RET}
2686host
2687@b{@trampfn{sudo, root, host, /etc} $} id @key{RET}
2688uid=0(root) gid=0(root) groups=0(root)
2689@b{@trampfn{sudo, root, host, /etc} $} find-file shadow @key{RET}
2690#<buffer shadow>
2691@b{@trampfn{sudo, root, host, /etc} $}
2692@end example
2693
07b6428c
MA
2694@ifset emacs
2695Since @value{emacsname} 23.2, @code{eshell} has also an own
2696implementation of the @code{su} and @code{sudo} commands. Both
2697commands change the default directory of the @file{*eshell*} buffer to
2698the value related to the user the command has switched to. This works
2699even on remote hosts, adding silently a corresponding entry to the
2700variable @code{tramp-default-proxies-alist} (@pxref{Multi-hops}):
2701
2702@example
2703@b{~ $} cd @trampfn{ssh, user, remotehost, /etc} @key{RET}
020335df 2704@b{@trampfn{ssh, user, remotehost, /etc} $} find-file shadow @key{RET}
07b6428c 2705File is not readable: @trampfn{ssh, user, remotehost, /etc/shadow}
020335df 2706@b{@trampfn{ssh, user, remotehost, /etc} $} sudo find-file shadow @key{RET}
07b6428c 2707#<buffer shadow>
020335df 2708
07b6428c
MA
2709@b{@trampfn{ssh, user, remotehost, /etc} $} su - @key{RET}
2710@b{@trampfn{su, root, remotehost, /root} $} id @key{RET}
2711uid=0(root) gid=0(root) groups=0(root)
2712@b{@trampfn{su, root, remotehost, /root} $}
2713@end example
2714@end ifset
2715
4009494e
GM
2716
2717@anchor{Running a debugger on a remote host}
2718@subsection Running a debugger on a remote host
2719@cindex gud
2720@cindex gdb
2721@cindex perldb
2722
2723@file{gud.el} offers an unified interface to several symbolic
2724debuggers
2725@ifset emacs
2726@ifinfo
2727(@ref{Debuggers, , , @value{emacsdir}}).
2728@end ifinfo
2729@end ifset
2730With @value{tramp}, it is possible to debug programs on
2731remote hosts. You can call @code{gdb} with a remote file name:
2732
2733@example
2734@kbd{M-x gdb @key{RET}}
2735@b{Run gdb (like this):} gdb --annotate=3 @trampfn{ssh, , host, ~/myprog} @key{RET}
2736@end example
2737
2738The file name can also be relative to a remote default directory.
2739Given you are in a buffer that belongs to the remote directory
2740@trampfn{ssh, , host, /home/user}, you could call
2741
2742@example
2743@kbd{M-x perldb @key{RET}}
2744@b{Run perldb (like this):} perl -d myprog.pl @key{RET}
2745@end example
2746
2747It is not possible to use just the absolute local part of a remote
2748file name as program to debug, like @kbd{perl -d
2749/home/user/myprog.pl}, though.
2750
2751Arguments of the program to be debugged are taken literally. That
f18ce50c 2752means, file names as arguments must be given as ordinary relative or
4009494e
GM
2753absolute file names, without any remote specification.
2754
2755
888a7fc0
MA
2756@subsection Running remote processes on Windows hosts
2757@cindex winexe
2758@cindex powershell
2759
2760With the help of the @command{winexe} it is possible tu run processes
2761on a remote Windows host. @value{tramp} has implemented this for
2762@code{process-file} and @code{start-file-process}.
2763
2764The variable @code{tramp-smb-winexe-program} must contain the file
2765name of your local @command{winexe} command. On the remote host,
2766Powershell V2.0 must be installed; it is used to run the remote
2767process.
2768
2769In order to open a remote shell on the Windows host via @kbd{M-x
2770shell}, you must set the variables @option{explicit-shell-file-name}
2771and @option{explicit-*-args}. If you want, for example, run
2772@command{cmd}, you must set:
2773
2774@lisp
2775(setq explicit-shell-file-name "cmd"
2776 explicit-cmd-args '("/q"))
2777@end lisp
2778
2779@noindent
2780In case of running @command{powershell} as remote shell, the settings are
2781
2782@lisp
2783(setq explicit-shell-file-name "powershell"
2784 explicit-powershell-args '("-file" "-"))
2785@end lisp
2786
2787
dd753688 2788@node Cleanup remote connections
888a7fc0 2789@section Cleanup remote connections
dd753688
MA
2790@cindex cleanup
2791
2792Sometimes it is useful to cleanup remote connections. The following
2793commands support this.
2794
2795@deffn Command tramp-cleanup-connection vec
2796This command flushes all connection related objects. @option{vec} is
2797the internal representation of a remote connection. Called
2798interactively, the command offers all active remote connections in the
2799minibuffer as remote file name prefix like @file{@trampfn{method,
2800user, host, }}. The cleanup includes password cache (@pxref{Password
a06a4a12 2801handling}), file cache, connection cache (@pxref{Connection caching}),
dd753688
MA
2802connection buffers.
2803@end deffn
2804
862c0d68
MA
2805@deffn Command tramp-cleanup-this-connection
2806This command flushes all objects of the current buffer's remote
2807connection. The same objects are removed as in
2808@code{tramp-cleanup-connection}.
2809@end deffn
2810
dd753688
MA
2811@deffn Command tramp-cleanup-all-connections
2812This command flushes objects for all active remote connections. The
2813same objects are removed as in @code{tramp-cleanup-connection}.
2814@end deffn
2815
2816@deffn Command tramp-cleanup-all-buffers
2817Like in @code{tramp-cleanup-all-connections}, all remote connections
2818are cleaned up. Additionally all buffers, which are related to a
2819remote connection, are killed.
2820@end deffn
2821
2822
4009494e
GM
2823@node Bug Reports
2824@chapter Reporting Bugs and Problems
2825@cindex bug reports
2826
2827Bugs and problems with @value{tramp} are actively worked on by the
2828development team. Feature requests and suggestions are also more than
2829welcome.
2830
2831The @value{tramp} mailing list is a great place to get information on
2832working with @value{tramp}, solving problems and general discussion
2833and advice on topics relating to the package. It is moderated so
2834non-subscribers can post but messages will be delayed, possibly up to
283548 hours (or longer in case of holidays), until the moderator approves
2836your message.
2837
2838The mailing list is at @email{tramp-devel@@gnu.org}. Messages sent to
2839this address go to all the subscribers. This is @emph{not} the address
2840to send subscription requests to.
2841
2842Subscribing to the list is performed via
2843@uref{http://lists.gnu.org/mailman/listinfo/tramp-devel/,
2844the @value{tramp} Mail Subscription Page}.
2845
dd753688 2846@findex tramp-bug
4009494e
GM
2847To report a bug in @value{tramp}, you should execute @kbd{M-x
2848tramp-bug}. This will automatically generate a buffer with the details
2849of your system and @value{tramp} version.
2850
2851When submitting a bug report, please try to describe in excruciating
2852detail the steps required to reproduce the problem, the setup of the
2853remote machine and any special conditions that exist. You should also
2854check that your problem is not described already in @xref{Frequently
2855Asked Questions}.
2856
2857If you can identify a minimal test case that reproduces the problem,
2858include that with your bug report. This will make it much easier for
2859the development team to analyze and correct the problem.
2860
20121a26
MA
2861Sometimes, there might be also problems due to Tramp caches. Flush
2862all caches before running the test, @ref{Cleanup remote connections}.
2863
4009494e
GM
2864Before reporting the bug, you should set the verbosity level to 6
2865(@pxref{Traces and Profiles, Traces}) in the @file{~/.emacs} file and
2866repeat the bug. Then, include the contents of the @file{*tramp/foo*}
2867and @file{*debug tramp/foo*} buffers in your bug report. A verbosity
2868level greater than 6 will produce a very huge debug buffer, which is
2869mostly not necessary for the analysis.
2870
2871Please be aware that, with a verbosity level of 6 or greater, the
2872contents of files and directories will be included in the debug
2873buffer. Passwords you've typed will never be included there.
2874
2875
2876@node Frequently Asked Questions
2877@chapter Frequently Asked Questions
2878@cindex frequently asked questions
2879@cindex FAQ
2880
2881@itemize @bullet
2882@item
2883Where can I get the latest @value{tramp}?
2884
2885@value{tramp} is available under the URL below.
2886
2887@noindent
2888@uref{ftp://ftp.gnu.org/gnu/tramp/}
2889
2890@noindent
2891There is also a Savannah project page.
2892
2893@noindent
2894@uref{http://savannah.gnu.org/projects/tramp/}
2895
2896
2897@item
2898Which systems does it work on?
2899
5d41af19
MA
2900The package has been used successfully on Emacs 22, Emacs 23, Emacs
290124, XEmacs 21 (starting with 21.4), and SXEmacs 22.
4009494e
GM
2902
2903The package was intended to work on Unix, and it really expects a
14029d4b
MA
2904Unix-like system on the remote end (except the @option{smb} method),
2905but some people seemed to have some success getting it to work on MS
2906Windows XP/Vista/7 @value{emacsname}.
4009494e 2907
4009494e
GM
2908
2909@item
2910How could I speed up @value{tramp}?
2911
2912In the backstage, @value{tramp} needs a lot of operations on the
2913remote host. The time for transferring data from and to the remote
2914host as well as the time needed to perform the operations there count.
2915In order to speed up @value{tramp}, one could either try to avoid some
2916of the operations, or one could try to improve their performance.
2917
193e6828 2918Use an external method, like @option{scpc}.
4009494e
GM
2919
2920Use caching. This is already enabled by default. Information about
2921the remote host as well as the remote files are cached for reuse. The
2922information about remote hosts is kept in the file specified in
37255945 2923@code{tramp-persistency-file-name}. Keep this file. If you are
36539990 2924confident that files on remote hosts are not changed out of
37255945 2925@value{emacsname}' control, set @code{remote-file-name-inhibit-cache}
f956e59d
MA
2926to @code{nil}. Set also @code{tramp-completion-reread-directory-timeout}
2927to @code{nil}, @ref{Filename completion}.
4009494e
GM
2928
2929Disable version control. If you access remote files which are not
2930under version control, a lot of check operations can be avoided by
1df7defd 2931disabling VC@. This can be achieved by
4009494e
GM
2932
2933@lisp
c0de5d04
MA
2934(setq vc-ignore-dir-regexp
2935 (format "\\(%s\\)\\|\\(%s\\)"
2936 vc-ignore-dir-regexp
2937 tramp-file-name-regexp))
4009494e
GM
2938@end lisp
2939
2940Disable excessive traces. The default trace level of @value{tramp},
2941defined in the variable @code{tramp-verbose}, is 3. You should
2942increase this level only temporarily, hunting bugs.
2943
2944
2945@item
2946@value{tramp} does not connect to the remote host
2947
5732e8ed 2948When @value{tramp} does not connect to the remote host, there are three
4009494e
GM
2949reasons heading the bug mailing list:
2950
2951@itemize @minus
4009494e
GM
2952@item
2953Unknown characters in the prompt
2954
2955@value{tramp} needs to recognize the prompt on the remote machine
36539990 2956after execution any command. This is not possible when the prompt
4009494e
GM
2957contains unknown characters like escape sequences for coloring. This
2958should be avoided on the remote side. @xref{Remote shell setup}. for
2959setting the regular expression detecting the prompt.
2960
2961You can check your settings after an unsuccessful connection by
2962switching to the @value{tramp} connection buffer @file{*tramp/foo*},
2963setting the cursor at the top of the buffer, and applying the expression
2964
2965@example
2966@kbd{M-: (re-search-forward (concat tramp-shell-prompt-pattern "$"))}
2967@end example
2968
2969If it fails, or the cursor is not moved at the end of the buffer, your
135305ed 2970prompt is not recognized correctly.
4009494e
GM
2971
2972A special problem is the zsh, which uses left-hand side and right-hand
2973side prompts in parallel. Therefore, it is necessary to disable the
2974zsh line editor on the remote host. You shall add to @file{~/.zshrc}
2975the following command:
2976
2977@example
2978[ $TERM = "dumb" ] && unsetopt zle && PS1='$ '
2979@end example
2980
36539990
MA
2981Furthermore it has been reported, that @value{tramp} (like sshfs,
2982incidentally) doesn't work with WinSSHD due to strange prompt settings.
2983
5732e8ed
MA
2984@item
2985Echoed characters after login
2986
2987When the remote machine opens an echoing shell, there might be control
2988characters in the welcome message. @value{tramp} tries to suppress
888a7fc0 2989such echoes via the @command{stty -echo} command, but sometimes this
5732e8ed
MA
2990command is not reached, because the echoed output has confused
2991@value{tramp} already. In such situations it might be helpful to use
2992the @option{sshx} or @option{scpx} methods, which allocate a pseudo tty.
2993@xref{Inline methods}.
2994
4009494e
GM
2995@item
2996@value{tramp} doesn't transfer strings with more than 500 characters
2997correctly
2998
2999On some few systems, the implementation of @code{process-send-string}
3000seems to be broken for longer strings. It is reported for HP-UX,
3001FreeBSD and Tru64 Unix, for example. This case, you should customize
3002the variable @code{tramp-chunksize} to 500. For a description how to
3003determine whether this is necessary see the documentation of
3004@code{tramp-chunksize}.
3005
3006Additionally, it will be useful to set @code{file-precious-flag} to
3007@code{t} for @value{tramp} files. Then the file contents will be
3008written into a temporary file first, which is checked for correct
3009checksum.
3010@ifinfo
3011@pxref{Saving Buffers, , , elisp}
3012@end ifinfo
3013
3014@lisp
3015(add-hook
d1069532
SM
3016 'find-file-hook
3017 (lambda ()
3018 (when (file-remote-p default-directory)
3019 (set (make-local-variable 'file-precious-flag) t))))
4009494e 3020@end lisp
4009494e
GM
3021@end itemize
3022
3023
3d1bfa99
MA
3024@item
3025@value{tramp} does not recognize hung @command{ssh} sessions
3026
3027When your network connection is down, @command{ssh} sessions might
3028hang. @value{tramp} cannot detect it safely, because it still sees a
3029running @command{ssh} process. Timeouts cannot be used as well,
36539990 3030because it cannot be predicted how long a remote command will last,
3d1bfa99
MA
3031for example when copying very large files.
3032
3033Therefore, you must configure the @command{ssh} process to die
3034in such a case. The following entry in @file{~/.ssh/config} would do
3035the job:
3036
3037@example
3038Host *
3039 ServerAliveInterval 5
3040@end example
3041
3042
888a7fc0
MA
3043@item
3044How can I use @samp{ControlPersist}?
3045
3046When @samp{ControlPersist} is set to @samp{yes}, the @option{scpc}
3047method does not work. You can use @option{scpx} instead with the
3048following settings in @file{~/.ssh/config}:
3049
3050@example
3051Host *
3052 ControlMaster auto
3053 ControlPersist yes
3054@end example
3055
3056
4009494e
GM
3057@item
3058File name completion does not work with @value{tramp}
3059
3060When you log in to the remote machine, do you see the output of
3061@command{ls} in color? If so, this may be the cause of your problems.
3062
3063@command{ls} outputs @acronym{ANSI} escape sequences that your terminal
3064emulator interprets to set the colors. These escape sequences will
3065confuse @value{tramp} however.
3066
3067In your @file{.bashrc}, @file{.profile} or equivalent on the remote
3068machine you probably have an alias configured that adds the option
3069@option{--color=yes} or @option{--color=auto}.
3070
3071You should remove that alias and ensure that a new login @emph{does not}
3072display the output of @command{ls} in color. If you still cannot use
3073filename completion, report a bug to the @value{tramp} developers.
3074
3075
3076@item
3077File name completion does not work in large directories
3078
3079@value{tramp} uses globbing for some operations. (Globbing means to use the
3080shell to expand wildcards such as `*.c'.) This might create long
3081command lines, especially in directories with many files. Some shells
3082choke on long command lines, or don't cope well with the globbing
3083itself.
3084
3085If you have a large directory on the remote end, you may wish to execute
3086a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
3087Note that you must first start the right shell, which might be
3088@command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
3089of those supports tilde expansion.
3090
3091
3092@item
3093How can I get notified when @value{tramp} file transfers are complete?
3094
3095The following snippet can be put in your @file{~/.emacs} file. It
3096makes @value{emacsname} beep after reading from or writing to the
3097remote host.
3098
3099@lisp
3100(defadvice tramp-handle-write-region
3101 (after tramp-write-beep-advice activate)
e1176b47
MA
3102 "Make tramp beep after writing a file."
3103 (interactive)
3104 (beep))
4009494e
GM
3105
3106(defadvice tramp-handle-do-copy-or-rename-file
3107 (after tramp-copy-beep-advice activate)
e1176b47
MA
3108 "Make tramp beep after copying a file."
3109 (interactive)
3110 (beep))
4009494e
GM
3111
3112(defadvice tramp-handle-insert-file-contents
e1176b47
MA
3113 (after tramp-insert-beep-advice activate)
3114 "Make tramp beep after inserting a file."
3115 (interactive)
3116 (beep))
3117@end lisp
3118
3119
3120@ifset emacs
3121@item
3122I'ld like to get a Visual Warning when working in a sudo:ed context
3123
3124When you are working with @samp{root} privileges, it might be useful
3125to get an indication in the buffer's modeline. The following code,
3126tested with @value{emacsname} 22.1, does the job. You should put it
3127into your @file{~/.emacs}:
3128
3129@lisp
3130(defun my-mode-line-function ()
3131 (when (string-match "^/su\\(do\\)?:" default-directory)
3132 (setq mode-line-format
3133 (format-mode-line mode-line-format 'font-lock-warning-face))))
3134
d1069532 3135(add-hook 'find-file-hook 'my-mode-line-function)
e1176b47 3136(add-hook 'dired-mode-hook 'my-mode-line-function)
4009494e 3137@end lisp
e1176b47 3138@end ifset
4009494e
GM
3139
3140
3141@ifset emacs
3142@item
3143I'ld like to see a host indication in the mode line when I'm remote
3144
3145The following code has been tested with @value{emacsname} 22.1. You
3146should put it into your @file{~/.emacs}:
3147
3148@lisp
3149(defconst my-mode-line-buffer-identification
3150 (list
3151 '(:eval
3152 (let ((host-name
3153 (if (file-remote-p default-directory)
3154 (tramp-file-name-host
3155 (tramp-dissect-file-name default-directory))
3156 (system-name))))
3157 (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name)
3158 (substring host-name 0 (match-beginning 1))
3159 host-name)))
3160 ": %12b"))
3161
3162(setq-default
3163 mode-line-buffer-identification
3164 my-mode-line-buffer-identification)
3165
3166(add-hook
3167 'dired-mode-hook
d1069532
SM
3168 (lambda ()
3169 (setq
3170 mode-line-buffer-identification
3171 my-mode-line-buffer-identification)))
4009494e
GM
3172@end lisp
3173
3174Since @value{emacsname} 23.1, the mode line contains an indication if
3175@code{default-directory} for the current buffer is on a remote host.
3176The corresponding tooltip includes the name of that host. If you
3177still want the host name as part of the mode line, you can use the
3178example above, but the @code{:eval} clause can be simplified:
3179
3180@lisp
3181 '(:eval
3182 (let ((host-name
3183 (or (file-remote-p default-directory 'host)
3184 (system-name))))
3185 (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name)
3186 (substring host-name 0 (match-beginning 1))
3187 host-name)))
3188@end lisp
3189@end ifset
3190
3191
3192@ifset emacs
3193@item
3194My remote host does not understand default directory listing options
3195
3196@value{emacsname} computes the @command{dired} options depending on
3197the local host you are working. If your @command{ls} command on the
3198remote host does not understand those options, you can change them
3199like this:
3200
3201@lisp
3202(add-hook
3203 'dired-before-readin-hook
d1069532
SM
3204 (lambda ()
3205 (when (file-remote-p default-directory)
3206 (setq dired-actual-switches "-al"))))
4009494e
GM
3207@end lisp
3208@end ifset
3209
3210
3211@item
3212There's this @file{~/.sh_history} file on the remote host which keeps
3213growing and growing. What's that?
3214
3215Sometimes, @value{tramp} starts @command{ksh} on the remote host for
3216tilde expansion. Maybe @command{ksh} saves the history by default.
3217@value{tramp} tries to turn off saving the history, but maybe you have
3218to help. For example, you could put this in your @file{.kshrc}:
3219
3220@example
3221if [ -f $HOME/.sh_history ] ; then
3222 /bin/rm $HOME/.sh_history
3223fi
3224if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
3225 unset HISTFILE
3226fi
3227if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
3228 unset HISTSIZE
3229fi
3230@end example
3231
3232
3233@item There are longish file names to type. How to shorten this?
3234
3235Let's say you need regularly access to @file{@trampfn{ssh, news,
3236news.my.domain, /opt/news/etc}}, which is boring to type again and
3237again. The following approaches can be mixed:
3238
3239@enumerate
3240
3241@item Use default values for method and user name:
3242
3243You can define default methods and user names for hosts,
3244(@pxref{Default Method}, @pxref{Default User}):
3245
3246@lisp
3247(setq tramp-default-method "ssh"
3248 tramp-default-user "news")
3249@end lisp
3250
3251The file name left to type would be
3252@kbd{C-x C-f @trampfn{, , news.my.domain, /opt/news/etc}}.
3253
36539990 3254Note that there are some useful settings already. Accessing your
4009494e
GM
3255local host as @samp{root} user, is possible just by @kbd{C-x C-f
3256@trampfn{su, , ,}}.
3257
3258@item Use configuration possibilities of your method:
3259
1df7defd 3260Several connection methods (i.e., the programs used) offer powerful
4009494e
GM
3261configuration possibilities (@pxref{Customizing Completion}). In the
3262given case, this could be @file{~/.ssh/config}:
3263
3264@example
3265Host xy
3266 HostName news.my.domain
3267 User news
3268@end example
3269
3270The file name left to type would be @kbd{C-x C-f @trampfn{ssh, , xy,
3271/opt/news/etc}}. Depending on files in your directories, it is even
9bbb9638 3272possible to complete the host name with @kbd{C-x C-f
4009494e
GM
3273@value{prefix}ssh@value{postfixhop}x @key{TAB}}.
3274
3275@item Use environment variables:
3276
3277File names typed in the minibuffer can be expanded by environment
3278variables. You can set them outside @value{emacsname}, or even with
3279Lisp:
3280
3281@lisp
3282(setenv "xy" "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")
3283@end lisp
3284
3285Then you need simply to type @kbd{C-x C-f $xy @key{RET}}, and here you
36539990 3286are. The disadvantage is that you cannot edit the file name, because
4009494e
GM
3287environment variables are not expanded during editing in the
3288minibuffer.
3289
3290@item Define own keys:
3291
3292You can define your own key sequences in @value{emacsname}, which can
3293be used instead of @kbd{C-x C-f}:
3294
3295@lisp
3296(global-set-key
3297 [(control x) (control y)]
3298 (lambda ()
3299 (interactive)
3300 (find-file
3301 (read-file-name
3302 "Find Tramp file: "
3303 "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))))
3304@end lisp
3305
3306Simply typing @kbd{C-x C-y} would initialize the minibuffer for
3307editing with your beloved file name.
3308
3309See also @uref{http://www.emacswiki.org/cgi-bin/wiki/TrampMode, the
3310Emacs Wiki} for a more comprehensive example.
3311
3312@item Define own abbreviation (1):
3313
3314It is possible to define an own abbreviation list for expanding file
3315names:
3316
3317@lisp
3318(add-to-list
3319 'directory-abbrev-alist
3320 '("^/xy" . "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))
3321@end lisp
3322
e1dbe924 3323This shortens the file opening command to @kbd{C-x C-f /xy
4009494e
GM
3324@key{RET}}. The disadvantage is, again, that you cannot edit the file
3325name, because the expansion happens after entering the file name only.
3326
3327@item Define own abbreviation (2):
3328
3329The @code{abbrev-mode} gives more flexibility for editing the
3330minibuffer:
3331
3332@lisp
3333(define-abbrev-table 'my-tramp-abbrev-table
3334 '(("xy" "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")))
3335
3336(add-hook
3337 'minibuffer-setup-hook
d1069532
SM
3338 (lambda ()
3339 (abbrev-mode 1)
3340 (setq local-abbrev-table my-tramp-abbrev-table)))
4009494e
GM
3341
3342(defadvice minibuffer-complete
3343 (before my-minibuffer-complete activate)
3344 (expand-abbrev))
3345
3346;; If you use partial-completion-mode
3347(defadvice PC-do-completion
3348 (before my-PC-do-completion activate)
3349 (expand-abbrev))
3350@end lisp
3351
3352After entering @kbd{C-x C-f xy @key{TAB}}, the minibuffer is
3353expanded, and you can continue editing.
3354
3355@item Use bookmarks:
3356
3357Bookmarks can be used to visit Tramp files or directories.
3358@ifinfo
3359@pxref{Bookmarks, , , @value{emacsdir}}
3360@end ifinfo
3361
3362When you have opened @file{@trampfn{ssh, news, news.my.domain,
3363/opt/news/etc/}}, you should save the bookmark via
3364@ifset emacs
3365@kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{set}}.
3366@end ifset
3367@ifset xemacs
3368@kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{set}}.
3369@end ifset
3370
3371Later on, you can always navigate to that bookmark via
3372@ifset emacs
3373@kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{jump}}.
3374@end ifset
3375@ifset xemacs
3376@kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{jump}}.
3377@end ifset
3378
3379@item Use recent files:
3380
3381@ifset emacs
3382@file{recentf}
3383@end ifset
3384@ifset xemacs
3385@file{recent-files}
3386@end ifset
3387remembers visited places.
3388@ifinfo
3389@ifset emacs
3390@pxref{File Conveniences, , , @value{emacsdir}}
3391@end ifset
3392@ifset xemacs
3393@pxref{recent-files, , , edit-utils}
3394@end ifset
3395@end ifinfo
3396
3397You could keep remote file names in the recent list without checking
3398their readability through a remote access:
3399
3400@lisp
3401@ifset emacs
3402(recentf-mode 1)
3403@end ifset
3404@ifset xemacs
3405(recent-files-initialize)
3406(add-hook
d1069532 3407 'find-file-hook
4009494e
GM
3408 (lambda ()
3409 (when (file-remote-p (buffer-file-name))
3410 (recent-files-make-permanent)))
3411 'append)
3412@end ifset
3413@end lisp
3414
3415The list of files opened recently is reachable via
3416@ifset emacs
3417@kbd{@key{menu-bar} @key{file} @key{Open Recent}}.
3418@end ifset
3419@ifset xemacs
3420@kbd{@key{menu-bar} @key{Recent Files}}.
3421@end ifset
3422
3423@ifset emacs
3424@item Use filecache:
3425
3426@file{filecache} remembers visited places. Add the directory into
3427the cache:
3428
3429@lisp
3430(eval-after-load "filecache"
3431 '(file-cache-add-directory
3432 "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))
3433@end lisp
3434
3435Whenever you want to load a file, you can enter @kbd{C-x C-f
3436C-@key{TAB}} in the minibuffer. The completion is done for the given
3437directory.
3438@end ifset
3439
3440@ifset emacs
3441@item Use bbdb:
3442
3443@file{bbdb} has a built-in feature for @value{ftppackagename} files,
3444which works also for @value{tramp}.
3445@ifinfo
3446@pxref{bbdb-ftp, Storing FTP sites in the BBDB, , bbdb}
3447@end ifinfo
3448
3449You need to load @file{bbdb}:
3450
3451@lisp
3452(require 'bbdb)
3453(bbdb-initialize)
3454@end lisp
3455
3456Then you can create a BBDB entry via @kbd{M-x bbdb-create-ftp-site}.
3457Because BBDB is not prepared for @value{tramp} syntax, you must
36539990 3458specify a method together with the user name when needed. Example:
4009494e
GM
3459
3460@example
3461@kbd{M-x bbdb-create-ftp-site @key{RET}}
3462@b{Ftp Site:} news.my.domain @key{RET}
3463@b{Ftp Directory:} /opt/news/etc/ @key{RET}
3464@b{Ftp Username:} ssh@value{postfixhop}news @key{RET}
3465@b{Company:} @key{RET}
3466@b{Additional Comments:} @key{RET}
3467@end example
3468
3469When you have opened your BBDB buffer, you can access such an entry by
3470pressing the key @key{F}.
3471@end ifset
3472
3473@end enumerate
3474
36539990 3475I would like to thank all @value{tramp} users who have contributed to
4009494e
GM
3476the different recipes!
3477
3478
66043531
MA
3479@ifset emacs
3480@item
3481How can I use @value{tramp} to connect to a remote @value{emacsname}
3482session?
3483
3484You can configure Emacs Client doing this.
3485@ifinfo
3486@xref{Emacs Server, , , @value{emacsdir}}.
3487@end ifinfo
3488
3489On the remote host, you start the Emacs Server:
3490
3491@lisp
3492(require 'server)
3493(setq server-host (system-name)
3494 server-use-tcp t)
3495(server-start)
3496@end lisp
3497
36539990 3498Make sure that the result of @code{(system-name)} can be resolved on
66043531
MA
3499your local host; otherwise you might use a hard coded IP address.
3500
3501The resulting file @file{~/.emacs.d/server/server} must be copied to
3502your local host, at the same location. You can call then the Emacs
3503Client from the command line:
3504
3505@example
3506emacsclient @trampfn{ssh, user, host, /file/to/edit}
3507@end example
3508
3509@code{user} and @code{host} shall be related to your local host.
3ef49c53
MA
3510
3511If you want to use Emacs Client also as editor for other programs, you
3512could write a script @file{emacsclient.sh}:
3513
3514@example
3515#!/bin/sh
456b348e 3516emacsclient @trampfn{ssh, $(whoami), $(hostname --fqdn), $1}
3ef49c53
MA
3517@end example
3518
888a7fc0 3519Then you must set the environment variable @env{EDITOR} pointing to
3ef49c53
MA
3520that script:
3521
3522@example
3523export EDITOR=/path/to/emacsclient.sh
3524@end example
66043531
MA
3525@end ifset
3526
3527
4009494e 3528@item
9024ff79
MA
3529There are packages which call @value{tramp} although I haven't entered
3530a remote file name ever. I dislike it, how could I disable it?
4009494e 3531
9024ff79
MA
3532In general, @value{tramp} functions are used only when
3533you apply remote file name syntax. However, some packages enable
3534@value{tramp} on their own.
4009494e 3535
586b90f1 3536@itemize @minus
9024ff79
MA
3537@item
3538@file{ido.el}
3539
3540You could disable @value{tramp} file name completion:
3541
3542@lisp
3543(custom-set-variables
3544 '(ido-enable-tramp-completion nil))
3545@end lisp
586b90f1
MA
3546
3547@item
9024ff79
MA
3548@file{rlogin.el}
3549
3550You could disable remote directory tracking mode:
3551
3552@lisp
3553(rlogin-directory-tracking-mode -1)
3554@end lisp
3555@end itemize
3556
3557
3558@item
3559How can I disable @value{tramp} at all?
3560
3561Shame on you, why did you read until now?
3562
3563@itemize @minus
4009494e 3564@ifset emacs
9024ff79 3565@item
4009494e
GM
3566If you just want to have @value{ftppackagename} as default remote
3567files access package, you should apply the following code:
3568
3569@lisp
3570(setq tramp-default-method "ftp")
3571@end lisp
3572@end ifset
3573
586b90f1
MA
3574@item
3575In order to disable
3576@ifset emacs
3577@value{tramp} (and @value{ftppackagename}),
3578@end ifset
3579@ifset xemacs
3580@value{tramp},
3581@end ifset
3582you must set @code{tramp-mode} to @code{nil}:
3583
3584@lisp
3585(setq tramp-mode nil)
3586@end lisp
3587
3588@item
4009494e
GM
3589Unloading @value{tramp} can be achieved by applying @kbd{M-x
3590tramp-unload-tramp}.
3591@ifset emacs
3592This resets also the @value{ftppackagename} plugins.
3593@end ifset
3594@end itemize
586b90f1 3595@end itemize
4009494e
GM
3596
3597
3598@c For the developer
4009494e
GM
3599@node Files directories and localnames
3600@chapter How file names, directories and localnames are mangled and managed.
3601
3602@menu
3603* Localname deconstruction:: Breaking a localname into its components.
ea3fc256
MA
3604@ifset emacs
3605* External packages:: Integration with external Lisp packages.
3606@end ifset
4009494e
GM
3607@end menu
3608
3609
3610@node Localname deconstruction
888a7fc0 3611@section Breaking a localname into its components
4009494e
GM
3612
3613@value{tramp} file names are somewhat different, obviously, to ordinary file
3614names. As such, the lisp functions @code{file-name-directory} and
3615@code{file-name-nondirectory} are overridden within the @value{tramp}
3616package.
3617
3618Their replacements are reasonably simplistic in their approach. They
3619dissect the filename, call the original handler on the localname and
3620then rebuild the @value{tramp} file name with the result.
3621
3622This allows the platform specific hacks in the original handlers to take
3623effect while preserving the @value{tramp} file name information.
3624
3625
ea3fc256
MA
3626@ifset emacs
3627@node External packages
888a7fc0 3628@section Integration with external Lisp packages
b59329e0 3629@subsection Filename completion.
ea3fc256
MA
3630
3631While reading filenames in the minibuffer, @value{tramp} must decide
3632whether it completes possible incomplete filenames, or not. Imagine
3633there is the following situation: You have typed @kbd{C-x C-f
3634@value{prefix}ssh@value{postfixhop} @key{TAB}}. @value{tramp} cannot
3635know, whether @option{ssh} is a method or a host name. It checks
3636therefore the last input character you have typed. If this is
3637@key{TAB}, @key{SPACE} or @kbd{?}, @value{tramp} assumes that you are
3638still in filename completion, and it does not connect to the possible
3639remote host @option{ssh}.
3640
3641@vindex tramp-completion-mode
3642External packages, which use other characters for completing filenames
3643in the minibuffer, must signal this to @value{tramp}. For this case,
3644the variable @code{tramp-completion-mode} can be bound temporarily to
b59329e0 3645a non-@code{nil} value.
ea3fc256
MA
3646
3647@lisp
3648(let ((tramp-completion-mode t))
3649 ...)
3650@end lisp
b59329e0
MA
3651
3652
3653@subsection File attributes cache.
3654
3655When @value{tramp} runs remote processes, files on the remote host
3656could change their attributes. Consequently, @value{tramp} must flush
3657its complete cache keeping attributes for all files of the remote host
3658it has seen so far.
3659
3660This is a performance degradation, because the lost file attributes
36539990 3661must be recomputed when needed again. In cases the caller of
bbb6ffa1 3662@code{process-file} knows that there are no file attribute changes, it
b59329e0
MA
3663shall let-bind the variable @code{process-file-side-effects} to
3664@code{nil}. @value{tramp} wouldn't flush the file attributes cache then.
3665
3666@lisp
3667(let (process-file-side-effects)
3668 ...)
3669@end lisp
bbb6ffa1
MA
3670
3671For asynchronous processes, @value{tramp} flushes the file attributes
3672cache via a process sentinel. If the caller of
3673@code{start-file-process} knows that there are no file attribute
3674changes, it shall set the process sentinel to @code{nil}. In case the
3675caller defines an own process sentinel, @value{tramp}'s process
3676sentinel is overwritten. The caller can still flush the file
3677attributes cache in its process sentinel with this code:
3678
3679@lisp
3680(unless (memq (process-status proc) '(run open))
3681 (dired-uncache remote-directory))
3682@end lisp
3683
3684@code{remote-directory} shall be the root directory, where file
3685attribute changes can happen during the process lifetime.
3686@value{tramp} traverses all subdirectories, starting at this
3687directory. Often, it is sufficient to use @code{default-directory} of
3688the process buffer as root directory.
ea3fc256
MA
3689@end ifset
3690
3691
4009494e
GM
3692@node Traces and Profiles
3693@chapter How to Customize Traces
3694
3695All @value{tramp} messages are raised with a verbosity level. The
3696verbosity level can be any number between 0 and 10. Only messages with
3697a verbosity level less than or equal to @code{tramp-verbose} are
3698displayed.
3699
3700The verbosity levels are
3701
3702 @w{ 0} silent (no @value{tramp} messages at all)
3703@*@indent @w{ 1} errors
3704@*@indent @w{ 2} warnings
3705@*@indent @w{ 3} connection to remote hosts (default verbosity)
3706@*@indent @w{ 4} activities
3707@*@indent @w{ 5} internal
3708@*@indent @w{ 6} sent and received strings
3709@*@indent @w{ 7} file caching
3710@*@indent @w{ 8} connection properties
3f2afe32 3711@*@indent @w{ 9} test commands
4009494e
GM
3712@*@indent @w{10} traces (huge)
3713
3714When @code{tramp-verbose} is greater than or equal to 4, the messages
3715are also written into a @value{tramp} debug buffer. This debug buffer
e4920bc9 3716is useful for analyzing problems; sending a @value{tramp} bug report
4009494e
GM
3717should be done with @code{tramp-verbose} set to a verbosity level of at
3718least 6 (@pxref{Bug Reports}).
3719
3720The debug buffer is in
3721@ifinfo
3722@ref{Outline Mode, , , @value{emacsdir}}.
3723@end ifinfo
3724@ifnotinfo
3725Outline Mode.
3726@end ifnotinfo
3727That means, you can change the level of messages to be viewed. If you
3728want, for example, see only messages up to verbosity level 5, you must
3729enter @kbd{C-u 6 C-c C-q}.
3730@ifinfo
3731Other keys for navigating are described in
3732@ref{Outline Visibility, , , @value{emacsdir}}.
3733@end ifinfo
3734
3735@value{tramp} errors are handled internally in order to raise the
3736verbosity level 1 messages. When you want to get a Lisp backtrace in
3737case of an error, you need to set both
3738
3739@lisp
3740(setq debug-on-error t
3741 debug-on-signal t)
3742@end lisp
3743
3744Sometimes, it might be even necessary to step through @value{tramp}
3745function call traces. Such traces are enabled by the following code:
3746
3747@lisp
3748(require 'tramp)
3749(require 'trace)
03b5bade
MA
3750(dolist (elt (all-completions "tramp-" obarray 'functionp))
3751 (trace-function-background (intern elt)))
4009494e
GM
3752(untrace-function 'tramp-read-passwd)
3753(untrace-function 'tramp-gw-basic-authentication)
3754@end lisp
3755
3756The function call traces are inserted in the buffer
3757@file{*trace-output*}. @code{tramp-read-passwd} and
3758@code{tramp-gw-basic-authentication} shall be disabled when the
3759function call traces are added to @value{tramp}, because both
3760functions return password strings, which should not be distributed.
3761
3762
3763@node Issues
3764@chapter Debatable Issues and What Was Decided
3765
3766@itemize @bullet
3767@item The uuencode method does not always work.
3768
3769Due to the design of @value{tramp}, the encoding and decoding programs
3770need to read from stdin and write to stdout. On some systems,
3771@command{uudecode -o -} will read stdin and write the decoded file to
3772stdout, on other systems @command{uudecode -p} does the same thing.
3773But some systems have uudecode implementations which cannot do this at
3774all---it is not possible to call these uudecode implementations with
3775suitable parameters so that they write to stdout.
3776
3777Of course, this could be circumvented: the @code{begin foo 644} line
3778could be rewritten to put in some temporary file name, then
3779@command{uudecode} could be called, then the temp file could be
3780printed and deleted.
3781
3782But I have decided that this is too fragile to reliably work, so on some
3783systems you'll have to do without the uuencode methods.
3784
6e7fa8e2 3785@item The @value{tramp} filename syntax differs between Emacs and XEmacs.
4009494e 3786
6e7fa8e2 3787The Emacs maintainers wish to use a unified filename syntax for
4009494e
GM
3788Ange-FTP and @value{tramp} so that users don't have to learn a new
3789syntax. It is sufficient to learn some extensions to the old syntax.
3790
3791For the XEmacs maintainers, the problems caused from using a unified
3792filename syntax are greater than the gains. The XEmacs package system
3793uses EFS for downloading new packages. So, obviously, EFS has to be
3794installed from the start. If the filenames were unified, @value{tramp}
3795would have to be installed from the start, too.
3796
3797@ifset xemacs
3798@strong{Note:} If you'd like to use a similar syntax like
3799@value{ftppackagename}, you need the following settings in your init
3800file:
3801
3802@lisp
3803(setq tramp-unified-filenames t)
3804(require 'tramp)
3805@end lisp
3806
3807The autoload of the @value{emacsname} @value{tramp} package must be
3808disabled. This can be achieved by setting file permissions @code{000}
3809to the files @file{.../xemacs-packages/lisp/tramp/auto-autoloads.el*}.
3810
3811In case of unified filenames, all @value{emacsname} download sites are
3812added to @code{tramp-default-method-alist} with default method
3813@option{ftp} @xref{Default Method}. These settings shouldn't be
3814touched for proper working of the @value{emacsname} package system.
3815
3816The syntax for unified filenames is described in the @value{tramp} manual
3817for @value{emacsothername}.
3818@end ifset
3819@end itemize
3820
3821@node GNU Free Documentation License
3822@appendix GNU Free Documentation License
3823@include doclicense.texi
3824
dd753688
MA
3825@node Function Index
3826@unnumbered Function Index
3827@printindex fn
3828
3829@node Variable Index
3830@unnumbered Variable Index
3831@printindex vr
3832
4009494e 3833@node Concept Index
4009494e
GM
3834@unnumbered Concept Index
3835@printindex cp
dd753688 3836
4009494e
GM
3837@bye
3838
3839@c TODO
3840@c
3841@c * Say something about the .login and .profile files of the remote
3842@c shells.
3843@c * Explain how tramp.el works in principle: open a shell on a remote
3844@c host and then send commands to it.
193e6828
MA
3845@c * Use `filename' resp. `file name' consistently.
3846@c * Use `host' resp. `machine' consistently.
c80e3b4a 3847@c * Consistent small or capitalized words especially in menus.