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