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