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