* xresources.texi (GTK resources): Added a note that some themes
[bpt/emacs.git] / man / tramp.texi
CommitLineData
fb7933a3
KG
1\input texinfo @c -*-texinfo-*-
2@c %**start of header
6344cbf1 3@setfilename ../info/tramp
fb7933a3
KG
4@settitle TRAMP User Manual
5@setchapternewpage odd
6@c %**end of header
7
8@c This is *so* much nicer :)
9@footnotestyle end
10
b1a2b924
KG
11@c In the Tramp CVS, the version number is auto-frobbed from
12@c configure.ac, so you should edit that file and run
13@c "autoconf && ./configure" to change the version number.
7e190783
KG
14
15@c Additionally, flags are set with respect to the Emacs flavor; and
16@c depending whether Tramp is packaged into (X)Emacs, or standalone.
17
b1a2b924 18@include trampver.texi
fb7933a3 19
fb7933a3
KG
20@c Macro to make formatting of the tramp program name consistent.
21@macro tramp
22@sc{tramp}
23@end macro
24
16674e4f 25@c Macros for formatting a filename.
884b79ec 26@c trampfn is for a full filename, trampfnmhp means method, host, localname
16674e4f 27@c were given, and so on.
884b79ec
KG
28@macro trampfn(method, user, host, localname)
29@value{tramp-prefix}@value{method}@value{user}@@@value{host}@value{tramp-postfix}@value{localname}
16674e4f 30@end macro
fb7933a3 31
f08d9f0e 32@copying
18d6d595 33Copyright @copyright{} 1999, 2000, 2001, 2002, 2003 Free Software
f08d9f0e
KG
34Foundation, Inc.
35
884b79ec 36@quotation
f08d9f0e
KG
37Permission is granted to copy, distribute and/or modify this document
38under the terms of the GNU Free Documentation License, Version 1.1 or
39any later version published by the Free Software Foundation; with no
40Invariant Sections, with the Front-Cover texts being ``A GNU
41Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
42license is included in the section entitled ``GNU Free Documentation
43License'' in the Emacs manual.
44
45(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
46this GNU Manual, like GNU software. Copies published by the Free
47Software Foundation raise funds for GNU development.''
48
49This document is part of a collection distributed under the GNU Free
50Documentation License. If you want to distribute this document
51separately from the collection, you can do so by adding a copy of the
52license to the document, as described in section 6 of the license.
53@end quotation
54@end copying
55
41bed43c
KG
56@c Entries for @command{install-info} to use
57@dircategory Emacs
58@direntry
59* TRAMP: (tramp). Transparent Remote Access, Multiple Protocol
60 Emacs remote file access via rsh and rcp.
61@end direntry
62
fb7933a3
KG
63@tex
64
65@titlepage
16674e4f 66@title @tramp{} version @trampver{} User Manual
fb7933a3
KG
67
68@author by Daniel Pittman
69@author based on documentation by Kai Gro@ss{}johann
f08d9f0e 70
fb7933a3 71@page
f08d9f0e 72@insertcopying
fb7933a3 73
fb7933a3
KG
74@end titlepage
75@page
76
77@end tex
78
79@ifnottex
92eeeafc 80@node Top, Overview, (dir), (dir)
16674e4f
KG
81@top @tramp{} version @trampver{} User Manual
82
83This file documents @tramp{} version @trampver{}, a remote file
84editing package for @value{emacs-name}.
fb7933a3
KG
85
86@tramp{} stands for `Transparent Remote (file) Access, Multiple
87Protocol'. This package provides remote file editing, similar to
16674e4f 88@value{ftp-package-name}.
fb7933a3 89
16674e4f
KG
90The difference is that @value{ftp-package-name} uses FTP to transfer
91files between the local and the remote host, whereas @tramp{} uses a
92combination of @command{rsh} and @command{rcp} or other work-alike
93programs, such as @command{ssh}/@command{scp}.
fb7933a3 94
fb7933a3
KG
95You can find the latest version of this document on the web at
96@uref{http://www.freesoftware.fsf.org/tramp/}.
97
7e190783
KG
98@c Pointer to the other Emacs flavor is necessary only in case of
99@c standalone installation. Text taken from trampinst.texi.
100@ifset tramp-inst
101@otherflavor{}
102@end ifset
103
fb7933a3
KG
104@ifhtml
105This manual is also available as a @uref{tramp_ja.html, Japanese
106translation}.
107
108The latest release of @tramp{} is available for
109@uref{http://savannah.gnu.org/download/tramp/,
110download}, or you may see @ref{Obtaining @tramp{}} for more details,
111including the CVS server details.
112
113@tramp{} also has a @uref{https://savannah.gnu.org/projects/tramp/,
114Savannah Project Page}.
115@end ifhtml
116
117There is a mailing list for @tramp{}, available at
118@email{tramp-devel@@mail.freesoftware.fsf.org}, and archived at
119@uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/} as
120well as the usual Savannah archives.
121
f08d9f0e
KG
122@insertcopying
123
fb7933a3
KG
124@end ifnottex
125
126@menu
fb7933a3
KG
127* Overview:: What @tramp{} can and cannot do.
128
129For the end user:
7e190783 130
18d6d595 131* Obtaining @tramp{}:: How to obtain @tramp{}.
16674e4f 132* History:: History of @tramp{}.
7e190783 133@ifset tramp-inst
16674e4f 134* Installation:: Installing @tramp{} with your @value{emacs-name}.
7e190783 135@end ifset
fb7933a3
KG
136* Configuration:: Configuring @tramp{} for use.
137* Usage:: An overview of the operation of @tramp{}.
16674e4f 138* Bug Reports:: Reporting Bugs and Problems.
fb7933a3 139* Frequently Asked Questions:: Questions and answers from the mailing list.
41bed43c 140* Concept Index:: An item for each concept
fb7933a3
KG
141
142For the developer:
7e190783 143
fb7933a3 144* Version Control:: The inner workings of remote version control.
884b79ec 145* Files directories and localnames:: How file names, directories and localnames are mangled and managed.
16674e4f 146* Issues:: Debatable Issues and What Was Decided.
fb7933a3
KG
147
148@detailmenu
149 --- The Detailed Node Listing ---
7e190783
KG
150@c
151@ifset tramp-inst
152Installing @tramp{} with your @value{emacs-name}
153
154* Installation parameters:: Parameters in order to control installation.
155* Load paths:: How to plug-in @tramp{} into your environment.
156
157@end ifset
fb7933a3
KG
158
159Configuring @tramp{} for use
160
161* Connection types:: Types of connections made to remote machines.
162* Inline methods:: Inline methods.
163* External transfer methods:: External transfer methods.
164* Multi-hop Methods:: Connecting to a remote host using multiple hops.
165* Default Method:: Selecting a default method.
166* Customizing Methods:: Using Non-Standard Methods.
16674e4f 167* Customizing Completion:: Selecting config files for user/host name completion.
fb7933a3 168* Remote Programs:: How @tramp{} finds and uses programs on the remote machine.
16674e4f
KG
169* Remote shell setup:: Remote shell setup hints.
170* Windows setup hints:: Issues with Cygwin ssh.
b1a2b924 171* Auto-save and Backup:: Auto-save and Backup.
fb7933a3
KG
172
173Using @tramp
174
175* Filename Syntax:: @tramp{} filename conventions.
16674e4f
KG
176* Multi-hop filename syntax:: Multi-hop filename conventions.
177* Filename completion:: Filename completion.
178* Dired:: Dired.
fb7933a3
KG
179
180The inner workings of remote version control
181
182* Version Controlled Files:: Determining if a file is under version control.
183* Remote Commands:: Executing the version control commands on the remote machine.
184* Changed workfiles:: Detecting if the working file has changed.
185* Checking out files:: Bringing the workfile out of the repository.
16674e4f 186* Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
fb7933a3
KG
187
188Things related to Version Control that don't fit elsewhere
189
190* Remote File Ownership:: How VC determines who owns a workfile.
191* Back-end Versions:: How VC determines what release your RCS is.
192
7e190783 193How file names, directories and localnames are mangled and managed
fb7933a3 194
b1a2b924 195* Localname deconstruction:: Breaking a localname into its components.
fb7933a3
KG
196
197@end detailmenu
198@end menu
199
fb7933a3
KG
200@node Overview
201@chapter An overview of @tramp
92eeeafc 202@cindex overview
fb7933a3 203
16674e4f
KG
204After the installation of @tramp{} into your @value{emacs-name}, you
205will be able to access files on remote machines as though they were
206local. Access to the remote file system for editing files, version
207control, and @command{dired} are transparently enabled.
fb7933a3
KG
208
209Your access to the remote machine can be with the @command{rsh},
210@command{rlogin}, @command{telnet} programs or with any similar
92eeeafc 211connection method. This connection must pass ASCII successfully to be
fb7933a3
KG
212usable but need not be 8-bit clean.
213
214The package provides support for @command{ssh} connections out of the
92eeeafc
KG
215box, one of the more common uses of the package. This allows
216relatively secure access to machines, especially if @command{ftp}
217access is disabled.
fb7933a3 218
92eeeafc
KG
219The majority of activity carried out by @tramp{} requires only that
220the remote login is possible and is carried out at the terminal. In
221order to access remote files @tramp{} needs to transfer their content
222to the local machine temporarily.
fb7933a3 223
92eeeafc
KG
224@tramp{} can transfer files between the machines in a variety of ways.
225The details are easy to select, depending on your needs and the
226machines in question.
fb7933a3 227
92eeeafc
KG
228The fastest transfer methods (for large files) rely on a remote file
229transfer package such as @command{rcp}, @command{scp} or
230@command{rsync}. The use of these methods is only possible if the
231file copy command does not ask for a password for the remote machine.
fb7933a3
KG
232
233If the remote copy methods are not suitable for you, @tramp{} also
92eeeafc
KG
234supports the use of encoded transfers directly through the shell.
235This requires that the @command{mimencode} or @command{uuencode} tools
236are available on the remote machine. These methods are generally
237faster for small files.
fb7933a3 238
92eeeafc
KG
239Within these limitations, @tramp{} is quite powerful. It is worth
240noting that, as of the time of writing, it is far from a polished
241end-user product. For a while yet you should expect to run into rough
242edges and problems with the code now and then.
fb7933a3
KG
243
244It is finished enough that the developers use it for day to day work but
245the installation and setup can be a little difficult to master, as can
246the terminology.
247
248@tramp{} is still under active development and any problems you encounter,
249trivial or major, should be reported to the @tramp{} developers.
250@xref{Bug Reports}.
251
252
253@subsubheading Behind the scenes
92eeeafc 254@cindex behind the scenes
e28e4d20
KG
255@cindex details of operation
256@cindex how it works
fb7933a3
KG
257
258This section tries to explain what goes on behind the scenes when you
259access a remote file through @tramp{}.
260
261Suppose you type @kbd{C-x C-f} and enter part of an @tramp{} file name,
262then hit @kbd{@key{TAB}} for completion. Suppose further that this is
263the first time that @tramp{} is invoked for the host in question. Here's
264what happens:
265
266@itemize
267@item
92eeeafc
KG
268@tramp{} discovers that it needs a connection to the host. So it
269invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
270@var{user}} or a similar tool to connect to the remote host.
16674e4f
KG
271Communication with this process happens through an
272@value{emacs-name} buffer, that is, the output from the remote end
273goes into a buffer.
fb7933a3
KG
274
275@item
276The remote host may prompt for a login name (for @command{telnet}). The
277login name is given in the file name, so @tramp{} sends the login name and
278a newline.
279
280@item
281The remote host may prompt for a password or pass phrase (for
282@command{rsh} or for @command{telnet} after sending the login name).
283@tramp{} displays the prompt in the minibuffer, asking you for the
284password or pass phrase.
285
286You enter the password or pass phrase. @tramp{} sends it to the remote
287host, followed by a newline.
288
289@item
290@tramp{} now waits for the shell prompt or for a message that the login
291failed.
292
293If @tramp{} sees neither of them after a certain period of time (a minute,
294say), then it issues an error message saying that it couldn't find the
295remote shell prompt and shows you what the remote host has sent.
296
16674e4f
KG
297If @tramp{} sees a @samp{login failed} message, it tells you so,
298aborts the login attempt and allows you to try again.
fb7933a3
KG
299
300@item
301Suppose that the login was successful and @tramp{} sees the shell prompt
302from the remote host. Now @tramp{} invokes @command{/bin/sh} because
303Bourne shells and C shells have different command
304syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
92eeeafc 305shell doesn't recognize @samp{exec /bin/sh} as a valid command.
fb7933a3
KG
306Maybe you use the Scheme shell @command{scsh}@dots{}}
307
308After the Bourne shell has come up, @tramp{} sends a few commands to
309ensure a good working environment. It turns off echoing, it sets the
310shell prompt, and a few other things.
311
312@item
313Now the remote shell is up and it good working order. Remember, what
314was supposed to happen is that @tramp{} tries to find out what files exist
315on the remote host so that it can do filename completion.
316
317So, @tramp{} basically issues @command{cd} and @command{ls} commands and
318also sometimes @command{echo} with globbing. Another command that is
319often used is @command{test} to find out whether a file is writable or a
320directory or the like. The output of each command is parsed for the
321necessary operation.
322
323@item
324Suppose you are finished with filename completion, have entered @kbd{C-x
325C-f}, a full file name and hit @kbd{@key{RET}}. Now comes the time to
326transfer the file contents from the remote host to the local host so
327that you can edit them.
328
329See above for an explanation of how @tramp{} transfers the file contents.
330
92eeeafc 331For inline transfers, @tramp{} issues a command like @samp{mimencode -b
fb7933a3
KG
332/path/to/remote/file}, waits until the output has accumulated in the
333buffer that's used for communication, then decodes that output to
334produce the file contents.
335
16674e4f
KG
336For out-of-band transfers, @tramp{} issues a command like the following:
337@example
338rcp user@@host:/path/to/remote/file /tmp/tramp.4711
339@end example
340It then reads the local temporary file @file{/tmp/tramp.4711} into a
341buffer and deletes the temporary file.
fb7933a3
KG
342
343@item
344You now edit the buffer contents, blithely unaware of what has happened
345behind the scenes. (Unless you have read this section, that is.) When
346you are finished, you type @kbd{C-x C-s} to save the buffer.
347
348@item
349Again, @tramp{} transfers the file contents to the remote host either
350inline or out-of-band. This is the reverse of what happens when reading
351the file.
352
353@end itemize
354
355I hope this has provided you with a basic overview of what happens
356behind the scenes when you open a file with @tramp{}.
357
358
359@c For the end user
360@node Obtaining @tramp{}
361@chapter Obtaining @tramp{}.
92eeeafc 362@cindex obtaining Tramp
fb7933a3 363
b1a2b924
KG
364@tramp{} is freely available on the Internet and the latest release
365may be downloaded from
366@uref{http://savannah.nongnu.org/download/tramp/}. This
367release includes the full documentation and code for @tramp{},
368suitable for installation. But Emacs (21.4 or later) includes
369@tramp{} already, and there is a @tramp{} package for XEmacs, as well.
370So maybe it is easier to just use those. But if you want the bleeding
92eeeafc 371edge, read on@dots{...}
fb7933a3 372
b1a2b924
KG
373For the especially brave, @tramp{} is available from CVS. The CVS
374version is the latest version of the code and may contain incomplete
375features or new issues. Use these versions at your own risk.
fb7933a3
KG
376
377Instructions for obtaining the latest development version of @tramp{}
16674e4f 378from CVS can be found by going to the Savannah project page at the
b1a2b924
KG
379following URL and then clicking on the CVS link in the navigation bar
380at the top.
16674e4f
KG
381
382@noindent
383@uref{http://savannah.gnu.org/projects/tramp/}
384
385@noindent
386Or follow the example session below:
fb7933a3
KG
387
388@example
16674e4f 389] @strong{cd ~/@value{emacs-dir}}
fb7933a3
KG
390] @strong{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp login}
391
392(Logging in to anoncvs@@subversions.gnu.org)
393CVS password: @strong{(just hit RET here)}
394@dots{}
395
396] @strong{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/tramp co tramp}
397@end example
398
16674e4f 399@noindent
b1a2b924
KG
400You should now have a directory @file{~/@value{emacs-dir}/tramp}
401containing the latest version of @tramp{}. You can fetch the latest
402updates from the repository by issuing the command:
fb7933a3
KG
403
404@example
16674e4f 405] @strong{cd ~/@value{emacs-dir}/tramp}
fb7933a3
KG
406] @strong{cvs update -d}
407@end example
408
b1a2b924
KG
409@noindent
410Once you've got updated files from the CVS repository, you need to run
411@command{autoconf} in order to get an up-to-date @file{configure}
412script:
413
414@example
415] @strong{cd ~/@value{emacs-dir}/tramp}
416] @strong{autoconf}
417@end example
418
fb7933a3
KG
419
420@node History
421@chapter History of @tramp{}
92eeeafc
KG
422@cindex history
423@cindex development history
fb7933a3
KG
424
425Development was started end of November 1998. The package was called
92eeeafc
KG
426@file{rssh.el}, back then. It only provided one method to access a
427file, using @command{ssh} to log in to a remote host and using
428@command{scp} to transfer the file contents. After a while, the name
429was changed to @file{rcp.el}, and now it's @tramp{}. Along the way,
430many more methods for getting a remote shell and for transferring the
431file contents were added. Support for VC was added.
fb7933a3 432
92eeeafc
KG
433The most recent addition of major features were the multi-hop methods
434added in April 2000 and the unification of @tramp{} and Ange-FTP
435filenames in July 2002.
fb7933a3 436
7e190783
KG
437@c Installation chapter is necessary only in case of standalone
438@c installation. Text taken from trampinst.texi.
439@ifset tramp-inst
440@installationchapter{}
16674e4f 441@end ifset
fb7933a3 442
fb7933a3
KG
443@node Configuration
444@chapter Configuring @tramp{} for use
92eeeafc 445@cindex configuration
fb7933a3 446
92eeeafc 447@cindex default configuration
fb7933a3 448@tramp{} is (normally) fully functional when it is initially
16674e4f 449installed. It is initially configured to use the @command{ssh} program
92eeeafc
KG
450to connect to the remote host and to use base-64 encoding (on the
451remote host, via @command{mimencode}, and on the local host via the
452built-in support for base-64 encoding in Emacs).
fb7933a3
KG
453
454On some hosts, there are problems with opening a connection. These are
455related to the behavior of the remote shell. See @xref{Remote shell
456setup}, for details on this.
457
92eeeafc
KG
458If you do not wish to use these commands to connect to the remote
459host, you should change the default connection and transfer method
460that @tramp uses. There are several different methods that @tramp{}
461can use to connect to remote machines and transfer files
462(@pxref{Connection types}).
fb7933a3
KG
463
464
465@menu
466* Connection types:: Types of connections made to remote machines.
467* Inline methods:: Inline methods.
468* External transfer methods:: External transfer methods.
469* Multi-hop Methods:: Connecting to a remote host using multiple hops.
470* Default Method:: Selecting a default method.
471* Customizing Methods:: Using Non-Standard Methods.
16674e4f 472* Customizing Completion:: Selecting config files for user/host name completion.
fb7933a3
KG
473* Remote Programs:: How @tramp{} finds and uses programs on the remote machine.
474* Remote shell setup:: Remote shell setup hints.
475* Windows setup hints:: Issues with Cygwin ssh.
b1a2b924 476* Auto-save and Backup:: Auto-save and Backup.
fb7933a3
KG
477@end menu
478
479
480@node Connection types
481@section Types of connections made to remote machines.
92eeeafc 482@cindex connection types, overview
fb7933a3
KG
483
484There are two basic types of transfer methods, each with its own
92eeeafc 485advantages and limitations. Both types of connection make use of a
fb7933a3
KG
486remote shell access program such as @command{rsh}, @command{ssh} or
487@command{telnet} to connect to the remote machine.
488
489This connection is used to perform many of the operations that @tramp
490requires to make the remote file system transparently accessible from
491the local machine. It is only when visiting files that the methods
492differ.
493
92eeeafc
KG
494@cindex inline methods
495@cindex external transfer methods
496@cindex external methods
497@cindex out-of-band methods
498@cindex methods, inline
499@cindex methods, external transfer
500@cindex methods, out-of-band
501Loading or saving a remote file requires that the content of the file
16674e4f
KG
502be transfered between the two machines. The content of the file can be
503transfered over the same connection used to log in to the remote
504machine or the file can be transfered through another connection using
92eeeafc
KG
505a remote copy program such as @command{rcp}, @command{scp} or
506@command{rsync}. The former are called @dfn{inline methods}, the
507latter are called @dfn{out-of-band methods} or @dfn{external transfer
508methods} (@dfn{external methods} for short).
fb7933a3
KG
509
510The performance of the external transfer methods is generally better
92eeeafc
KG
511than that of the inline methods, at least for large files. This is
512caused by the need to encode and decode the data when transferring
513inline.
fb7933a3
KG
514
515The one exception to this rule are the @command{scp} based transfer
516methods. While these methods do see better performance when actually
517transferring files, the overhead of the cryptographic negotiation at
518startup may drown out the improvement in file transfer times.
519
520External transfer methods do require that the remote copy command is not
521interactive --- that is, the command does not prompt you for a password.
522If you cannot perform remote copies without a password, you will need to
523use an inline transfer method to work with @tramp{}.
524
92eeeafc
KG
525@cindex multi-hop methods
526@cindex methods, multi-hop
fb7933a3
KG
527A variant of the inline methods are the @dfn{multi-hop methods}.
528These methods allow you to connect a remote host using a number `hops',
529each of which connects to a different host. This is useful if you are
530in a secured network where you need to go through a bastion host to
531connect to the outside world.
532
533
534@node Inline methods
535@section Inline methods
92eeeafc
KG
536@cindex inline methods
537@cindex methods, inline
fb7933a3
KG
538
539The inline methods in @tramp{} are quite powerful and can work in
540situations where you cannot use an external transfer program to connect.
541Inline methods are the only methods that work when connecting to the
542remote machine via telnet. (There are also strange inline methods which
543allow you to transfer files between @emph{user identities} rather than
544hosts, see below.)
545
546These methods depend on the existence of a suitable encoding and
92eeeafc 547decoding command on remote machine. Locally, @tramp{} may be able to use
fb7933a3
KG
548features of Emacs to decode and encode the files or it may require
549access to external commands to perform that task.
550
92eeeafc 551@cindex uuencode
92eeeafc
KG
552@cindex mimencode
553@cindex base-64 encoding
f08d9f0e
KG
554@tramp{} checks the availability and usability of commands like
555@command{mimencode} (part of the @command{metamail} package) or
556@command{uuencode} on the remote host. The first reliable command
557will be used. The search path can be customized, see @ref{Remote
558Programs}.
fb7933a3 559
abc6be8d 560If both commands aren't available on the remote host, @tramp{}
f08d9f0e
KG
561transfers a small piece of Perl code to the remote host, and tries to
562apply it for encoding and decoding.
fb7933a3 563
fb7933a3 564
f08d9f0e
KG
565@table @asis
566@item @option{rsh}
567@cindex method rsh
568@cindex rsh method
fb7933a3 569
f08d9f0e
KG
570Connect to the remote host with @command{rsh}. Due to the unsecure
571connection it is recommended for very local host topology only.
fb7933a3 572
41bed43c
KG
573On operating systems which provide the command @command{remsh} instead
574of @command{rsh}, you can use the method @option{remsh}. This is true
575for HP-UX or Cray UNICOS, for example.
576
fb7933a3 577
f08d9f0e
KG
578@item @option{ssh}
579@cindex method ssh
580@cindex ssh method
fb7933a3 581
f08d9f0e
KG
582Connect to the remote host with @command{ssh}. This is identical to
583the previous option except that the @command{ssh} package is used,
584making the connection more secure.
fb7933a3 585
f08d9f0e
KG
586There are also two variants, @option{ssh1} and @option{ssh2}, that
587call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
90dc758d
KG
588explicitly select whether you want to use the SSH protocol version 1
589or 2 to connect to the remote host. (You can also specify in
590@file{~/.ssh/config}, the SSH configuration file, which protocol
f08d9f0e 591should be used, and use the regular @option{ssh} method.)
90dc758d 592
f08d9f0e
KG
593Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
594@command{ssh1} and @command{ssh2} commands explicitly. If you don't
595know what these are, you do not need these options.
fb7933a3 596
16674e4f 597All the methods based on @command{ssh} have an additional kludgy
8e3a1104
KG
598feature: you can specify a host name which looks like @file{host#42}
599(the real host name, then a hash sign, then a port number). This
600means to connect to the given host but to also pass @code{-p 42} as
601arguments to the @command{ssh} command.
602
fb7933a3 603
f08d9f0e
KG
604@item @option{telnet}
605@cindex method telnet
606@cindex telnet method
fb7933a3 607
f08d9f0e
KG
608Connect to the remote host with @command{telnet}. This is as unsecure
609as the @option{rsh} method.
fb7933a3 610
fb7933a3 611
f08d9f0e 612@item @option{su}
92eeeafc
KG
613@cindex method su
614@cindex su method
fb7933a3 615
f08d9f0e
KG
616This method does not connect to a remote host at all, rather it uses
617the @command{su} program to allow you to edit files as another user.
fb7933a3 618
fb7933a3 619
f08d9f0e
KG
620@item @option{sudo}
621@cindex method sudo
622@cindex sudo method
fb7933a3 623
f08d9f0e 624This is similar to the @option{su} method, but it uses @command{sudo}
fb7933a3
KG
625rather than @command{su} to become a different user.
626
627Note that @command{sudo} must be configured to allow you to start a
628shell as the user. It would be nice if it was sufficient if
f08d9f0e
KG
629@command{ls} and @command{mimencode} were allowed, but that is not
630easy to implement, so I haven't got around to it, yet.
fb7933a3 631
fb7933a3 632
f08d9f0e
KG
633@item @option{sshx}
634@cindex method sshx
635@cindex sshx method
636@cindex Cygwin (with sshx method)
fb7933a3 637
f08d9f0e
KG
638As you expect, this is similar to @option{ssh}, only a little
639different. Whereas @option{ssh} opens a normal interactive shell on
92eeeafc 640the remote host, this option uses @samp{ssh -t -t @var{host} -l
16674e4f 641@var{user} /bin/sh} to open a connection. This is useful for users
92eeeafc
KG
642where the normal login shell is set up to ask them a number of
643questions when logging in. This procedure avoids these questions, and
644just gives @tramp{} a more-or-less `standard' login shell to work
645with.
fb7933a3 646
83fa16cf
KG
647Note that this procedure does not eliminate questions asked by
648@command{ssh} itself. For example, @command{ssh} might ask ``Are you
649sure you want to continue connecting?'' if the host key of the remote
abc6be8d 650host is not known. @tramp{} does not know how to deal with such a
83fa16cf
KG
651question (yet), therefore you will need to make sure that you can log
652in without such questions.
653
fb7933a3
KG
654This is also useful for Windows users where @command{ssh}, when
655invoked from an Emacs buffer, tells them that it is not allocating a
656pseudo tty. When this happens, the login shell is wont to not print
92eeeafc
KG
657any shell prompt, which confuses @tramp{} mightily. For reasons
658unknown, some Windows ports for @command{ssh} (maybe the Cygwin one)
659require the doubled @samp{-t} option.
fb7933a3 660
92eeeafc 661This supports the @samp{-p} kludge.
8e3a1104 662
fb7933a3 663
f08d9f0e
KG
664@item @option{krlogin}
665@cindex method krlogin
666@cindex km krlogin
667@cindex Kerberos (with krlogin method)
fb7933a3 668
f08d9f0e 669This method is also similar to @option{ssh}. It only uses the
fb7933a3
KG
670@command{krlogin -x} command to log in to the remote host.
671
672
f08d9f0e
KG
673@item @option{plink}
674@cindex method plink
675@cindex plink method
fb7933a3
KG
676
677This method is mostly interesting for Windows users using the PuTTY
92eeeafc 678implementation of SSH. It uses @samp{plink -ssh} to log in to the
fb7933a3
KG
679remote host.
680
41bed43c
KG
681Additionally, the method @option{plink1} is provided, which calls
682@samp{plink -1 -ssh} in order to use SSH protocol version 1
683explicitely.
684
fb7933a3
KG
685CCC: Do we have to connect to the remote host once from the command
686line to accept the SSH key? Maybe this can be made automatic?
687
abc6be8d
KG
688CCC: Does @command{plink} support the @samp{-p} option? @tramp{} will
689support that, anyway.
8e3a1104 690
92eeeafc 691@end table
fb7933a3
KG
692
693
694
695@node External transfer methods
696@section External transfer methods
92eeeafc
KG
697@cindex methods, external transfer
698@cindex methods, out-of-band
699@cindex external transfer methods
700@cindex out-of-band methods
fb7933a3
KG
701
702The external transfer methods operate through multiple channels, using
703the remote shell connection for many actions while delegating file
704transfers to an external transfer utility.
705
706This saves the overhead of encoding and decoding that multiplexing the
707transfer through the one connection has with the inline methods.
708
709If you want to use an external transfer method you @emph{must} be able
710to execute the transfer utility to copy files to and from the remote
711machine without any interaction.
712
92eeeafc 713@cindex ssh-agent
fb7933a3
KG
714This means that you will need to use @command{ssh-agent} if you use the
715@command{scp} program for transfers, or maybe your version of
716@command{scp} accepts a password on the command line.@footnote{PuTTY's
717@command{pscp} allows you to specify the password on the command line.}
718If you use @command{rsync} via @command{ssh} then the same rule must
719apply to that connection.
720
721If you cannot get @command{scp} to run without asking for a password but
722would still like to use @command{ssh} to secure your connection, have a
723look at the @command{ssh} based inline methods.
724
725
92eeeafc 726@table @asis
fb7933a3 727@item @option{rcp} --- @command{rsh} and @command{rcp}
92eeeafc
KG
728@cindex method rcp
729@cindex rcp method
e28e4d20
KG
730@cindex rcp (with rcp method)
731@cindex rsh (with rcp method)
fb7933a3
KG
732
733This method uses the @command{rsh} and @command{rcp} commands to connect
41bed43c 734to the remote machine and transfer files. This is probably the fastest
fb7933a3
KG
735connection method available.
736
41bed43c
KG
737The alternative method @option{remcp} uses the @command{remsh} and
738@command{rcp} commands. It should be applied on machines where
739@command{remsh} is used instead of @command{rsh}.
740
fb7933a3
KG
741
742@item @option{scp} --- @command{ssh} and @command{scp}
92eeeafc
KG
743@cindex method scp
744@cindex scp method
e28e4d20
KG
745@cindex scp (with scp method)
746@cindex ssh (with scp method)
fb7933a3
KG
747
748Using @command{ssh} to connect to the remote host and @command{scp} to
749transfer files between the machines is the best method for securely
750connecting to a remote machine and accessing files.
751
752The performance of this option is also quite good. It may be slower than
753the inline methods when you often open and close small files however.
754The cost of the cryptographic handshake at the start of an @command{scp}
755session can begin to absorb the advantage that the lack of encoding and
756decoding presents.
757
f08d9f0e
KG
758There are also two variants, @option{scp1} and @option{scp2}, that
759call @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can
760explicitly select whether you want to use the SSH protocol version 1
761or 2 to connect to the remote host. (You can also specify in
762@file{~/.ssh/config}, the SSH configuration file, which protocol
763should be used, and use the regular @option{ssh} method.)
764
765Two other variants, @option{scp1_old} and @option{scp2_old}, use the
766@command{ssh1} and @command{ssh2} commands explicitly. If you don't
767know what these are, you do not need these options.
768
16674e4f 769All the @command{ssh} based methods support the kludgy @samp{-p}
8e3a1104 770feature where you can specify a port number to connect to in the host
abc6be8d 771name. For example, the host name @file{host#42} tells @tramp{} to
92eeeafc 772specify @samp{-p 42} in the argument list for @command{ssh}.
8e3a1104 773
fb7933a3
KG
774
775@item @option{rsync} --- @command{ssh} and @command{rsync}
92eeeafc
KG
776@cindex method rsync
777@cindex rsync method
e28e4d20
KG
778@cindex rsync (with rsync method)
779@cindex ssh (with rsync method)
fb7933a3
KG
780
781Using the @command{ssh} command to connect securely to the remote
782machine and the @command{rsync} command to transfer files is almost
783identical to the @option{scp} method.
784
785While @command{rsync} performs much better than @command{scp} when
786transferring files that exist on both hosts, this advantage is lost if
787the file exists only on one side of the connection.
788
789The @command{rsync} based method may be considerably faster than the
790@command{rcp} based methods when writing to the remote system. Reading
abc6be8d 791files to the local machine is no faster than with a direct copy.
fb7933a3 792
92eeeafc 793This method supports the @samp{-p} hack.
8e3a1104 794
fb7933a3
KG
795
796@item @option{scpx} --- @command{ssh} and @command{scp}
92eeeafc
KG
797@cindex method scpx
798@cindex scpx method
e28e4d20
KG
799@cindex scp (with scpx method)
800@cindex ssh (with scpx method)
801@cindex Cygwin (with scpx method)
fb7933a3
KG
802
803As you expect, this is similar to @option{scp}, only a little
92eeeafc
KG
804different. Whereas @option{scp} opens a normal interactive shell on
805the remote host, this option uses @samp{ssh -t -t @var{host} -l
806@var{user} /bin/sh} to open a connection. This is useful for users
807where the normal login shell is set up to ask them a number of
808questions when logging in. This procedure avoids these questions, and
809just gives @tramp{} a more-or-less `standard' login shell to work
810with.
fb7933a3
KG
811
812This is also useful for Windows users where @command{ssh}, when
813invoked from an Emacs buffer, tells them that it is not allocating a
814pseudo tty. When this happens, the login shell is wont to not print
92eeeafc
KG
815any shell prompt, which confuses @tramp{} mightily. Maybe this
816applies to the Cygwin port of SSH.
fb7933a3 817
92eeeafc 818This method supports the @samp{-p} hack.
8e3a1104 819
fb7933a3
KG
820
821@item @option{pscp} --- @command{plink} and @command{pscp}
92eeeafc
KG
822@cindex method pscp
823@cindex pscp method
e28e4d20
KG
824@cindex pscp (with pscp method)
825@cindex plink (with pscp method)
826@cindex PuTTY (with pscp method)
fb7933a3
KG
827
828This method is similar to @option{scp}, but it uses the
829@command{plink} command to connect to the remote host, and it uses
830@command{pscp} for transferring the files. These programs are part
831of PuTTY, an SSH implementation for Windows.
832
92eeeafc 833CCC: Does @command{plink} support the @samp{-p} hack?
8e3a1104 834
fb7933a3
KG
835
836@item @option{fcp} --- @command{fsh} and @command{fcp}
92eeeafc
KG
837@cindex method fcp
838@cindex fcp method
e28e4d20
KG
839@cindex fsh (with fcp method)
840@cindex fcp (with fcp method)
fb7933a3
KG
841
842This method is similar to @option{scp}, but it uses the @command{fsh}
843command to connect to the remote host, and it uses @command{fcp} for
844transferring the files. @command{fsh/fcp} are a front-end for
845@command{ssh} which allow for reusing the same @command{ssh} session
846for submitting several commands. This avoids the startup overhead of
847@command{scp} (which has to establish a secure connection whenever it
848is called). Note, however, that you can also use one of the inline
849methods to achieve a similar effect.
850
92eeeafc
KG
851This method uses the command @samp{fsh @var{host} -l @var{user}
852/bin/sh -i} to establish the connection, it does not work to just say
853@command{fsh @var{host} -l @var{user}}.
fb7933a3 854
e28e4d20
KG
855@cindex method fsh
856@cindex fsh method
92eeeafc
KG
857There is no inline method using @command{fsh} as the multiplexing
858provided by the program is not very useful in our context. @tramp{}
859opens just one connection to the remote host and then keeps it open,
860anyway.
861
f08d9f0e
KG
862
863@ifset emacs
864@item @option{ftp}
865@cindex method ftp
866@cindex ftp method
867
abc6be8d 868This is not a native @tramp{} method. Instead of, it forwards all
f08d9f0e
KG
869requests to @value{ftp-package-name}.
870@end ifset
871
abc6be8d
KG
872
873@item @option{smb} --- @command{smbclient}
874@cindex method smb
875@cindex smb method
876
877This is another not natural @tramp{} method. It uses the
878@command{smbclient} command on different Unices in order to connect to
879an SMB server. An SMB server might be a Samba (or CIFS) server on
880another UNIX host or, more interesting, a host running MS Windows. So
881far, it is tested towards MS Windows NT, MS Windows 2000, and MS
882Windows XP.
883
884b79ec 884The first directory in the localname must be a share name on the remote
abc6be8d
KG
885host. Remember, that the @code{$} character in which default shares
886usually end, must be written @code{$$} due to environment variable
887substitution in file names. If no share name is given (i.e. remote
888directory @code{/}), all available shares are listed.
889
890Since authorization is done on share level, you will be prompted
891always for a password if you access another share on the same host.
892Due to security reasons, the password is not cached.
893
894MS Windows uses for authorization both a user name and a domain name.
895Because of this, the @tramp{} syntax has been extended: you can
896specify a user name which looks like @code{user%domain} (the real user
897name, then a percent sign, then the domain name). So, to connect to
898the machine @code{melancholia} as user @code{daniel} of the domain
899@code{BIZARRE}, and edit @file{.emacs} in the home directory (share
900@code{daniel$}) I would specify the filename
901@file{@value{tramp-prefix}smb@value{tramp-postfix-single-hop}daniel%BIZARRE@@melancholia@value{tramp-postfix}/daniel$$/.emacs}.
902
903The domain name as well as the user name are optional. If no user
904name is specified at all, the anonymous user (without password
905prompting) is assumed. This is different from all other @tramp{}
906methods, where in such a case the local user name is taken.
907
908The @option{smb} method supports the @samp{-p} hack.
909
910@strong{Please note:} If Emacs runs locally under MS Windows, this
911method isn't available. Instead of, you can use UNC file names like
912@file{//melancholia/daniel$$/.emacs}. The only disadvantage is that
41bed43c 913there's no possibility to specify another user name.
abc6be8d 914
92eeeafc 915@end table
fb7933a3
KG
916
917@node Multi-hop Methods
918@section Connecting to a remote host using multiple hops
92eeeafc
KG
919@cindex multi-hop methods
920@cindex methods, multi-hop
fb7933a3
KG
921
922Sometimes, the methods described before are not sufficient. Sometimes,
923it is not possible to connect to a remote host using a simple command.
924For example, if you are in a secured network, you might have to log in
925to a `bastion host' first before you can connect to the outside world.
926Of course, the target host may also require a bastion host. The format
927of multi-hop filenames is slightly different than the format of normal
928@tramp{} methods.
929
92eeeafc
KG
930@cindex method multi
931@cindex multi method
884b79ec
KG
932A multi-hop file name specifies a method, a number of hops, and a
933localname (path name on the remote system). The method name is always
f08d9f0e 934@option{multi}.
fb7933a3 935
f08d9f0e
KG
936Each hop consists of a @dfn{hop method} specification, a user name and
937a host name. The hop method can be an inline method only. The
938following hop methods are (currently) available:
fb7933a3 939
92eeeafc
KG
940@table @option
941@item telnet
942@cindex hop method telnet
943@cindex telnet hop method
fb7933a3
KG
944
945Uses the well-known @command{telnet} program to connect to the host.
946Whereas user name and host name are supplied in the file name, the
947user is queried for the password.
948
92eeeafc
KG
949@item rsh
950@cindex hop method rsh
951@cindex rsh hop method
fb7933a3
KG
952
953This uses @command{rsh} to connect to the host. You do not need to
954enter a password unless @command{rsh} explicitly asks for it.
955
41bed43c
KG
956The variant @option{remsh} uses the @command{remsh} command. It
957should be applied on machines where @command{remsh} is used instead of
958@command{rsh}.
959
92eeeafc
KG
960@item ssh
961@cindex hop method ssh
962@cindex ssh hop method
fb7933a3
KG
963
964This uses @command{ssh} to connect to the host. You might have to enter
965a password or a pass phrase.
966
92eeeafc
KG
967@item su
968@cindex hop method su
969@cindex su hop method
fb7933a3
KG
970
971This method does not actually contact a different host, but it allows
972you to become a different user on the host you're currently on. This
973might be useful if you want to edit files as root, but the remote host
974does not allow remote root logins. In this case you can use
975@option{telnet}, @option{rsh} or @option{ssh} to connect to the
976remote host as a non-root user, then use an @option{su} hop to become
977root. But @option{su} need not be the last hop in a sequence, you could
978also use it somewhere in the middle, if the need arises.
979
f08d9f0e 980Even though you @emph{must} specify both user and host with an
fb7933a3
KG
981@option{su} hop, the host name is ignored and only the user name is
982used.
983
92eeeafc
KG
984@item sudo
985@cindex hop method sudo
986@cindex sudo hop method
fb7933a3
KG
987
988This is similar to the @option{su} hop, except that it uses
989@command{sudo} rather than @command{su} to become a different user.
990
92eeeafc 991@end table
fb7933a3 992
92eeeafc
KG
993Some people might wish to use port forwarding with @command{ssh} or
994maybe they have to use a nonstandard port. This can be accomplished
995by putting a stanza in @file{~/.ssh/config} for the account which
996specifies a different port number for a certain host name. But it can
f08d9f0e
KG
997also be accomplished within @tramp{}, by adding a multi-hop method.
998For example:
fb7933a3
KG
999
1000@lisp
16674e4f
KG
1001(add-to-list
1002 'tramp-multi-connection-function-alist
1003 '("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n"))
fb7933a3
KG
1004@end lisp
1005
16674e4f 1006Now you can use an @code{sshf} hop which connects to port 4400 instead of
fb7933a3
KG
1007the standard port.
1008
1009
1010@node Default Method
1011@section Selecting a default method
92eeeafc 1012@cindex default method
fb7933a3 1013
92eeeafc 1014@vindex tramp-default-method
fb7933a3
KG
1015When you select an appropriate transfer method for your typical usage
1016you should set the variable @var{tramp-default-method} to reflect that
92eeeafc 1017choice. This variable controls which method will be used when a method
884b79ec 1018is not specified in the @tramp{} file name. For example:
fb7933a3
KG
1019
1020@lisp
1021(setq tramp-default-method "scp")
1022@end lisp
1023
92eeeafc
KG
1024@vindex tramp-default-method-alist
1025You can also specify different methods for certain user/host
1026combinations, via the variable @var{tramp-default-method-alist}. For
f08d9f0e 1027example, the following two lines specify to use the @option{ssh}
92eeeafc
KG
1028method for all user names matching @samp{john} and the @option{rsync}
1029method for all host names matching @samp{lily}. The third line
f08d9f0e 1030specifies to use the @option{su} method for the user @samp{root} on
92eeeafc
KG
1031the machine @samp{localhost}.
1032
1033@lisp
f08d9f0e 1034(add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
92eeeafc
KG
1035(add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
1036(add-to-list 'tramp-default-method-alist
f08d9f0e 1037 '("\\`localhost\\'" "\\`root\\'" "su"))
92eeeafc
KG
1038@end lisp
1039
1040@noindent
1041See the documentation for the variable
1042@var{tramp-default-method-alist} for more details.
1043
fb7933a3
KG
1044External transfer methods are normally preferable to inline transfer
1045methods, giving better performance. They may not be useful if you use
1046many remote machines where you cannot log in without a password.
1047
1048@xref{Inline methods}.
1049@xref{External transfer methods}.
1050@xref{Multi-hop Methods}.
1051
1052Another consideration with the selection of transfer methods is the
1053environment you will use them in and, especially when used over the
1054Internet, the security implications of your preferred method.
1055
1056The @command{rsh} and @command{telnet} methods send your password as
1057plain text as you log in to the remote machine, as well as transferring
1058the files in such a way that the content can easily be read from other
1059machines.
1060
1061If you need to connect to remote systems that are accessible from the
1062Internet, you should give serious thought to using @command{ssh} based
1063methods to connect. These provide a much higher level of security,
1064making it a non-trivial exercise for someone to obtain your password or
1065read the content of the files you are editing.
1066
1067@node Customizing Methods
1068@section Using Non-Standard Methods
92eeeafc
KG
1069@cindex customizing methods
1070@cindex using non-standard methods
1071@cindex create your own methods
fb7933a3
KG
1072
1073There is a variable @code{tramp-methods} which you can change if the
1074predefined methods don't seem right.
1075
1076For the time being, I'll refer you to the Lisp documentation of that
1077variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.
1078
1079
16674e4f
KG
1080@node Customizing Completion
1081@section Selecting config files for user/host name completion
1082@cindex customizing completion
1083@cindex selecting config files
1084@vindex tramp-completion-function-alist
1085
1086The variable @code{tramp-completion-function-alist} is intended to
abc6be8d 1087customize which files are taken into account for user and host name
16674e4f
KG
1088completion (@pxref{Filename completion}). For every method, it keeps
1089a set of configuration files, accompanied by a Lisp function able to
1090parse that file. Entries in @code{tramp-completion-function-alist}
1091have the form (@var{method} @var{pair1} @var{pair2} ...).
1092
1093Each @var{pair} is composed of (@var{function} @var{file}).
1094@var{function} is responsible to extract user names and host names
1095from @var{file} for completion. There are two functions which access
1096this variable:
1097
1098@defun tramp-get-completion-function method
1099This function returns the list of completion functions for @var{method}.
1100
1101Example:
1102@example
1103(tramp-get-completion-function "rsh")
1104
1105 @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
1106 (tramp-parse-rhosts "~/.rhosts"))
1107@end example
1108@end defun
1109
1110@defun tramp-set-completion-function method function-list
1111This function sets @var{function-list} as list of completion functions
884b79ec 1112for @var{method}.
16674e4f
KG
1113
1114Example:
1115@example
1116(tramp-set-completion-function "ssh"
18d6d595
KG
1117 '((tramp-parse-sconfig "/etc/ssh_config")
1118 (tramp-parse-sconfig "~/.ssh/config")))
16674e4f 1119
18d6d595
KG
1120 @result{} ((tramp-parse-sconfig "/etc/ssh_config")
1121 (tramp-parse-sconfig "~/.ssh/config"))
16674e4f
KG
1122@end example
1123@end defun
1124
18d6d595 1125The following predefined functions parsing configuration files exist:
16674e4f
KG
1126
1127@table @asis
1128@item @code{tramp-parse-rhosts}
1129@findex tramp-parse-rhosts
1130
1131This function parses files which are syntactical equivalent to
1132@file{~/.rhosts}. It returns both host names and user names, if
1133specified.
1134
1135@item @code{tramp-parse-shosts}
1136@findex tramp-parse-shosts
1137
1138This function parses files which are syntactical equivalent to
18d6d595 1139@file{~/.ssh/known_hosts}. Since there are no user names specified
16674e4f
KG
1140in such files, it can return host names only.
1141
18d6d595
KG
1142@item @code{tramp-parse-sconfig}
1143@findex tramp-parse-shosts
1144
41bed43c 1145This function returns the host nicknames defined by @code{Host} entries
18d6d595
KG
1146in @file{~/.ssh/config} style files.
1147
16674e4f
KG
1148@item @code{tramp-parse-hosts}
1149@findex tramp-parse-hosts
1150
1151A function dedicated to @file{/etc/hosts} style files. It returns
1152host names only.
1153
1154@item @code{tramp-parse-passwd}
1155@findex tramp-parse-passwd
1156
292ffc15
KG
1157A function which parses @file{/etc/passwd} like files. Obviously, it
1158can return user names only.
16674e4f 1159
292ffc15
KG
1160@item @code{tramp-parse-netrc}
1161@findex tramp-parse-netrc
1162
1163Finally, a function which parses @file{~/.netrc} like files.
1164@end table
16674e4f
KG
1165
1166If you want to keep your own data in a file, with your own structure,
1167you might provide such a function as well. This function must meet
1168the following conventions:
1169
1170@defun my-tramp-parse file
1171@var{file} must be either a file name on your host, or @code{nil}. The
1172function must return a list of (@var{user} @var{host}), which are
1173taken as candidates for user and host name completion.
1174
1175Example:
1176@example
1177(my-tramp-parse "~/.my-tramp-hosts")
1178
1179 @result{} ((nil "toto") ("daniel" "melancholia"))
1180@end example
1181@end defun
1182
1183
fb7933a3
KG
1184@node Remote Programs
1185@section How @tramp{} finds and uses programs on the remote machine.
1186
1187@tramp{} depends on a number of programs on the remote host in order to
1188function, including @command{ls}, @command{test}, @command{find} and
1189@command{cat}.
1190
1191In addition to these required tools, there are various tools that may be
1192required based on the connection method. See @ref{Inline methods} and
1193@ref{External transfer methods} for details on these.
1194
1195Certain other tools, such as @command{perl} (or @command{perl5}) and
1196@command{grep} will be used if they can be found. When they are
1197available, they are used to improve the performance and accuracy of
1198remote file access.
1199
92eeeafc 1200@vindex tramp-remote-path
fb7933a3
KG
1201When @tramp{} connects to the remote machine, it searches for the
1202programs that it can use. The variable @var{tramp-remote-path} controls
1203the directories searched on the remote machine.
1204
1205By default, this is set to a reasonable set of defaults for most
1206machines. It is possible, however, that your local (or remote ;) system
1207administrator has put the tools you want in some obscure local
1208directory.
1209
1210In this case, you can still use them with @tramp{}. You simply need to
1211add code to your @file{.emacs} to add the directory to the remote path.
1212This will then be searched by @tramp{} when you connect and the software
1213found.
1214
1215To add a directory to the remote search path, you could use code such
1216as:
1217
16674e4f
KG
1218@lisp
1219@i{;; We load @tramp{} to define the variable.}
1220(require 'tramp)
1221@i{;; We have @command{perl} in "/usr/local/perl/bin"}
92eeeafc 1222(add-to-list 'tramp-remote-path "/usr/local/perl/bin")
16674e4f
KG
1223@end lisp
1224
fb7933a3
KG
1225
1226@node Remote shell setup
1227@comment node-name, next, previous, up
1228@section Remote shell setup hints
92eeeafc 1229@cindex remote shell setup
e28e4d20
KG
1230@cindex @file{.profile} file
1231@cindex @file{.login} file
92eeeafc 1232@cindex shell init files
fb7933a3
KG
1233
1234As explained in the @ref{Overview} section, @tramp{} connects to the
1235remote host and talks to the shell it finds there. Of course, when you
1236log in, the shell executes its init files. Suppose your init file
16674e4f 1237requires you to enter the birth date of your mother; clearly @tramp{}
fb7933a3
KG
1238does not know this and hence fails to log you in to that host.
1239
1240There are different possible strategies for pursuing this problem. One
1241strategy is to enable @tramp{} to deal with all possible situations.
1242This is a losing battle, since it is not possible to deal with
1243@emph{all} situations. The other strategy is to require you to set up
1244the remote host such that it behaves like @tramp{} expect. This might
1245be inconvenient because you have to invest a lot of effort into shell
1246setup before you can begin to use @tramp{}.
1247
1248The package, therefore, pursues a combined approach. It tries to figure
1249out some of the more common setups, and only requires you to avoid
1250really exotic stuff. For example, it looks through a list of
1251directories to find some programs on the remote host. And also, it
abc6be8d 1252knows that it is not obvious how to check whether a file exists, and
fb7933a3
KG
1253therefore it tries different possibilities. (On some hosts and shells,
1254the command @code{test -e} does the trick, on some hosts the shell
1255builtin doesn't work but the program @code{/usr/bin/test -e} or
1256@code{/bin/test -e} works. And on still other hosts, @code{ls -d} is
1257the right way to do this.)
1258
1259Below you find a discussion of a few things that @tramp{} does not deal
1260with, and that you therefore have to set up correctly.
1261
92eeeafc
KG
1262@table @asis
1263@item @var{shell-prompt-pattern}
fb7933a3 1264@vindex shell-prompt-pattern
92eeeafc 1265
fb7933a3
KG
1266After logging in to the remote host, @tramp{} has to wait for the remote
1267shell startup to finish before it can send commands to the remote
1268shell. The strategy here is to wait for the shell prompt. In order to
1269recognize the shell prompt, the variable @code{shell-prompt-pattern} has
1270to be set correctly to recognize the shell prompt on the remote host.
1271
abc6be8d
KG
1272Note that @tramp{} requires the match for @code{shell-prompt-pattern}
1273to be at the end of the buffer. Many people have something like the
83fa16cf 1274following as the value for the variable: @code{"^[^>$][>$] *"}. Now
abc6be8d
KG
1275suppose your shell prompt is @code{a <b> c $ }. In this case,
1276@tramp{} recognizes the @code{>} character as the end of the prompt,
1277but it is not at the end of the buffer.
83fa16cf 1278
16674e4f
KG
1279@item @var{tramp-shell-prompt-pattern}
1280@vindex tramp-shell-prompt-pattern
1281
1282This regular expression is used by @tramp{} in the same way as
1283@code{shell-prompt-pattern}, to match prompts from the remote shell.
1284This second variable exists because the prompt from the remote shell
1285might be different from the prompt from a local shell --- after all,
1286the whole point of @tramp{} is to log in to remote hosts as a
1287different user. The default value of
1288@code{tramp-shell-prompt-pattern} is the same as the default value of
1289@code{shell-prompt-pattern}, which is reported to work well in many
1290circumstances.
1291
fb7933a3 1292@item @code{tset} and other questions
92eeeafc
KG
1293@cindex Unix command tset
1294@cindex tset Unix command
fb7933a3
KG
1295
1296Some people invoke the @code{tset} program from their shell startup
16674e4f
KG
1297scripts which asks the user about the terminal type of the shell.
1298Maybe some shells ask other questions when they are started. @tramp{}
1299does not know how to answer these questions. There are two approaches
1300for dealing with this problem. One approach is to take care that the
1301shell does not ask any questions when invoked from @tramp{}. You can
1302do this by checking the @code{TERM} environment variable, it will be
1303set to @code{dumb} when connecting.
fb7933a3
KG
1304
1305@vindex tramp-terminal-type
1306The variable @code{tramp-terminal-type} can be used to change this value
16674e4f
KG
1307to @code{dumb}.
1308
1309The other approach is to teach @tramp{} about these questions. See
1310the variables @code{tramp-actions-before-shell} and
1311@code{tramp-multi-actions} (for multi-hop connections).
fb7933a3 1312
6013ce47
KG
1313@item Non-Bourne commands in @file{.profile}
1314
1315After logging in to the remote host, @tramp{} issues the command
1316@code{exec /bin/sh}. (Actually, the command is slightly different.)
1317When @code{/bin/sh} is executed, it reads some init files, such as
1318@file{~/.shrc} or @file{~/.profile}.
1319
1320Now, some people have a login shell which is not @code{/bin/sh} but a
1321Bourne-ish shell such as bash or ksh. Some of these people might put
1322their shell setup into the files @code{~/.shrc} or @code{~/.profile}.
1323This way, it is possible for non-Bourne constructs to end up in those
1324files. Then, @code{exec /bin/sh} might cause the Bourne shell to barf
1325on those constructs.
1326
1327As an example, imagine somebody putting @code{export FOO=bar} into the
1328file @file{~/.profile}. The standard Bourne shell does not understand
1329this syntax and will emit a syntax error when it reaches this line.
1330
1331Another example is the tilde (@code{~}) character, say when adding
1332@file{~/bin} to @code{$PATH}. Many Bourne shells will not expand this
1333character, and since there is usually no directory whose name consists
1334of the single character tilde, strange things will happen.
1335
1336What can you do about this?
1337
1338Well, one possibility is to make sure that everything in @file{~/.shrc}
1339and @file{~/.profile} on all remote hosts is Bourne-compatible. In the
1340above example, instead of @code{export FOO=bar}, you might use
1341@code{FOO=bar; export FOO} instead.
1342
1343The other possibility is to put your non-Bourne shell setup into some
1344other files. For example, bash reads the file @file{~/.bash_profile}
1345instead of @file{~/.profile}, if the former exists. So bash
1346aficionados just rename their @file{~/.profile} to
1347@file{~/.bash_profile} on all remote hosts, and Bob's your uncle.
1348
1349The @tramp{} developers would like to circumvent this problem, so if you
1350have an idea about it, please tell us. However, we are afraid it is not
1351that simple: before saying @code{exec /bin/sh}, @tramp{} does not know
1352which kind of shell it might be talking to. It could be a Bourne-ish
1353shell like ksh or bash, or it could be a csh derivative like tcsh, or
1354it could be zsh, or even rc. If the shell is Bourne-ish already, then
1355it might be prudent to omit the @code{exec /bin/sh} step. But how to
1356find out if the shell is Bourne-ish?
1357
92eeeafc 1358@end table
fb7933a3
KG
1359
1360
b1a2b924
KG
1361@node Auto-save and Backup
1362@section Auto-save and Backup configuration
1363@cindex auto-save
1364@cindex backup
1365@vindex backup-directory-alist
1366
1367Explaining auto-save is still to do.
1368
1369Normally, Emacs writes backup files to the same directory as the
1370original files, but this behavior can be changed via the variable
1371@code{backup-directory-alist}. In connection with @tramp{}, this can
1372have unexpected side effects. Suppose that you specify that all backups
1373should go to the directory @file{~/.emacs.d/backups/}, and then you edit
1374the file @file{/su:root@@localhost:/etc/secretfile}. The effect is that
1375the backup file will be owned by you and not by root, thus possibly
1376enabling others to see it even if they were not intended to see it.
1377
1378When @code{backup-directory-alist} is nil (the default), such problems
1379do not occur.
1380
1381If you wish to customize the variable, the workaround is to include
1382special settings for Tramp files. For example, the following statement
1383effectively `turns off' the effect of @code{backup-directory-alist} for
1384@tramp{} files:
1385
1386@lisp
1387(require 'tramp)
1388(add-to-list 'backup-directory-alist
1389 (cons tramp-file-name-regexp nil))
1390@end lisp
1391
1392
fb7933a3
KG
1393@node Windows setup hints
1394@section Issues with Cygwin ssh
e28e4d20 1395@cindex Cygwin, issues
fb7933a3
KG
1396
1397This section needs a lot of work! Please help.
1398
abc6be8d
KG
1399@cindex method sshx with Cygwin
1400@cindex sshx method with Cygwin
fb7933a3
KG
1401If you use the Cygwin installation of ssh (you have to explicitly select
1402it in the installer), then it should work out of the box to just select
abc6be8d 1403@code{sshx} as the connection method. You can find information about
fb7933a3
KG
1404setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}.
1405
abc6be8d
KG
1406@cindex method scpx with Cygwin
1407@cindex scpx method with Cygwin
1408If you wish to use the @code{scpx} connection method, then you might
1409have the problem that Emacs calls @code{scp} with a Windows filename
1410such as @code{c:/foo}. The Cygwin version of @code{scp} does not know
1411about Windows filenames and interprets this as a remote filename on the
1412host @code{c}.
1413
1414One possible workaround is to write a wrapper script for @code{scp}
1415which converts the Windows filename to a Cygwinized filename.
1416
1417I guess that another workaround is to run Emacs under Cygwin, or to run
1418a Cygwinized Emacs.
1419
1420@cindex Cygwin and ssh-agent
1421@cindex SSH_AUTH_SOCK and Emacs on Windows
1422If you want to use either @code{ssh} based method on Windows, then you
1423might encounter problems with @code{ssh-agent}. Using this program,
1424you can avoid typing the pass-phrase every time you log in (and the
1425@code{scpx} method more or less requires you to use @code{ssh-agent}
1426because it does not allow you to type a password or pass-phrase).
1427However, if you start Emacs from a desktop shortcut, then the
1428environment variable @code{SSH_AUTH_SOCK} is not set and so Emacs and
1429thus @tramp{} and thus @code{ssh} and @code{scp} started from @tramp{}
1430cannot communicate with @code{ssh-agent}. It works better to start
1431Emacs from the shell.
1432
1433If anyone knows how to start @code{ssh-agent} under Windows in such a
1434way that desktop shortcuts can profit, please holler. I don't really
1435know anything at all about Windows@dots{}
1436
fb7933a3
KG
1437
1438@node Usage
1439@chapter Using @tramp
92eeeafc 1440@cindex using @tramp
fb7933a3
KG
1441
1442Once you have installed @tramp{} it will operate fairly transparently. You
1443will be able to access files on any remote machine that you can log in
1444to as though they were local.
1445
1446Files are specified to @tramp{} using a formalized syntax specifying the
92eeeafc 1447details of the system to connect to. This is similar to the syntax used
16674e4f
KG
1448by the @value{ftp-package-name} package.
1449
1450@cindex type-ahead
1451Something that might happen which surprises you is that Emacs
1452remembers all your keystrokes, so if you see a password prompt from
1453Emacs, say, and hit @kbd{@key{RET}} twice instead of once, then the
1454second keystroke will be processed by Emacs after @tramp{} has done
1455its thing. Why, this type-ahead is normal behavior, you say. Right
1456you are, but be aware that opening a remote file might take quite a
1457while, maybe half a minute when a connection needs to be opened.
1458Maybe after half a minute you have already forgotten that you hit that
1459key!
fb7933a3
KG
1460
1461@menu
1462* Filename Syntax:: @tramp{} filename conventions.
16674e4f
KG
1463* Multi-hop filename syntax:: Multi-hop filename conventions.
1464* Filename completion:: Filename completion.
1465* Dired:: Dired.
fb7933a3
KG
1466@end menu
1467
1468
1469@node Filename Syntax
1470@section @tramp{} filename conventions
92eeeafc
KG
1471@cindex filename syntax
1472@cindex filename examples
fb7933a3 1473
884b79ec 1474To access the file @var{localname} on the remote machine @var{machine} you
16674e4f 1475would specify the filename
884b79ec 1476@file{@value{tramp-prefix}@var{machine}@value{tramp-postfix}@var{localname}}.
16674e4f
KG
1477This will connect to @var{machine} and transfer the file using the
1478default method. @xref{Default Method}.
fb7933a3 1479
16674e4f 1480Some examples of @tramp{} filenames are shown below.
fb7933a3
KG
1481
1482@table @file
16674e4f 1483@item @value{tramp-prefix}melancholia@value{tramp-postfix}.emacs
fb7933a3
KG
1484Edit the file @file{.emacs} in your home directory on the machine
1485@code{melancholia}.
1486
16674e4f 1487@item @value{tramp-prefix}melancholia.danann.net@value{tramp-postfix}.emacs
fb7933a3
KG
1488This edits the same file, using the fully qualified domain name of
1489the machine.
1490
16674e4f 1491@item @value{tramp-prefix}melancholia@value{tramp-postfix}~/.emacs
fb7933a3
KG
1492This also edits the same file --- the @file{~} is expanded to your
1493home directory on the remote machine, just like it is locally.
1494
16674e4f 1495@item @value{tramp-prefix}melancholia@value{tramp-postfix}~daniel/.emacs
fb7933a3
KG
1496This edits the file @file{.emacs} in the home directory of the user
1497@code{daniel} on the machine @code{melancholia}. The @file{~<user>}
1498construct is expanded to the home directory of that user on the remote
1499machine.
1500
16674e4f 1501@item @value{tramp-prefix}melancholia@value{tramp-postfix}/etc/squid.conf
fb7933a3
KG
1502This edits the file @file{/etc/squid.conf} on the machine
1503@code{melancholia}.
1504
1505@end table
1506
16674e4f
KG
1507Unless you specify a different name to use, @tramp{} will use the
1508current local user name as the remote user name to log in with. If you
1509need to log in as a different user, you can specify the user name as
1510part of the filename.
fb7933a3 1511
16674e4f
KG
1512To log in to the remote machine as a specific user, you use the syntax
1513@file{@value{tramp-prefix}@var{user}@@@var{machine}@value{tramp-postfix}/@var{path/to.file}}.
1514That means that connecting to @code{melancholia} as @code{daniel} and
f37fc5a7 1515editing @file{.emacs} in your home directory you would specify
16674e4f 1516@file{@value{tramp-prefix}daniel@@melancholia@value{tramp-postfix}.emacs}.
fb7933a3
KG
1517
1518It is also possible to specify other file transfer methods
16674e4f
KG
1519(@pxref{Default Method}) as part of the filename.
1520@ifset emacs
1521This is done by putting the method before the user and host name, as
1522in
1523@file{@value{tramp-prefix}@var{method}@value{tramp-postfix-single-hop}}
abc6be8d 1524(Note the trailing colon).
16674e4f
KG
1525@end ifset
1526@ifset xemacs
1527This is done by replacing the initial
1528@file{@value{tramp-prefix}} with
1529@file{@value{tramp-prefix}<method>@value{tramp-postfix-single-hop}}.
1530(Note the trailing slash!).
1531@end ifset
1532The user, machine and file specification remain the same.
fb7933a3 1533
f37fc5a7
KG
1534So, to connect to the machine @code{melancholia} as @code{daniel},
1535using the @option{su} method to transfer files, and edit @file{.emacs}
1536in my home directory I would specify the filename
16674e4f 1537@file{@value{tramp-prefix}su@value{tramp-postfix-single-hop}daniel@@melancholia@value{tramp-postfix}.emacs}.
fb7933a3
KG
1538
1539
1540@node Multi-hop filename syntax
1541@section Multi-hop filename conventions
92eeeafc
KG
1542@cindex filename syntax for multi-hop files
1543@cindex multi-hop filename syntax
fb7933a3
KG
1544
1545The syntax of multi-hop file names is necessarily slightly different
16674e4f
KG
1546than the syntax of other @tramp{} file names. Here's an example
1547multi-hop file name, first in Emacs syntax and then in XEmacs syntax:
fb7933a3 1548
16674e4f
KG
1549@example
1550@value{tramp-prefix}multi@value{tramp-postfix-single-hop}rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host@value{tramp-postfix}/path/to.file
1551@end example
fb7933a3
KG
1552
1553This is quite a mouthful. So let's go through it step by step. The
16674e4f
KG
1554file name consists of three parts.
1555@ifset emacs
1556The parts are separated by colons
1557@end ifset
1558@ifset xemacs
1559The parts are separated by slashes and square brackets.
1560@end ifset
1561The first part is @file{@value{tramp-prefix}multi}, the method
1562specification. The second part is
1563@file{rsh@value{tramp-postfix-multi-hop}out@@gate@value{tramp-postfix-single-hop}telnet@value{tramp-postfix-multi-hop}kai@@real.host}
1564and specifies the hops. The final part is @file{/path/to.file} and
1565specifies the file name on the remote host.
fb7933a3 1566
abc6be8d 1567The first part and the final part should be clear. See @ref{Multi-hop
fb7933a3
KG
1568Methods}, for a list of alternatives for the method specification.
1569
16674e4f
KG
1570The second part can be subdivided again into components, so-called
1571hops. In the above file name, there are two hops,
1572@file{rsh@value{tramp-postfix-multi-hop}out@@gate} and
1573@file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}.
fb7933a3
KG
1574
1575Each hop can @emph{again} be subdivided into (three) components, the
1576@dfn{hop method}, the @dfn{user name} and the @dfn{host name}. The
1577meaning of the second and third component should be clear, and the hop
1578method says what program to use to perform that hop.
1579
16674e4f
KG
1580The first hop, @file{rsh@value{tramp-postfix-multi-hop}out@@gate},
1581says to use @command{rsh} to log in as user @code{out} to the host
1582@code{gate}. Starting at that host, the second hop,
1583@file{telnet@value{tramp-postfix-multi-hop}kai@@real.host}, says to
1584use @command{telnet} to log in as user @code{kai} to host
1585@code{real.host}.
1586
1587@xref{Multi-hop Methods}, for a list of possible hop method values.
1588The variable @code{tramp-multi-connection-function-alist} contains the
1589list of possible hop methods and information on how to execute them,
1590should you want to add your own.
fb7933a3 1591
16674e4f
KG
1592
1593@node Filename completion
1594@section Filename completion
1595@cindex filename completion
1596
1597Filename completion works with @tramp{} for both completing methods,
1598user names and machine names (except multi hop methods) as well as for
1599files on remote machines.
1600
1601If you, for example, type @kbd{C-x C-f @value{tramp-prefix}t
1602@key{TAB}}, @tramp{} might give you as result the choice for
1603
1604@example
1605@ifset emacs
1606@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop} tmp/
1607@value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1608@end ifset
1609@ifset xemacs
1610@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop} @value{tramp-prefix-single-hop}toto@value{tramp-postfix}
1611@end ifset
1612@end example
177c0ea7 1613
16674e4f
KG
1614@samp{@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}}
1615is a possible completion for the respective method,
1616@ifset emacs
1617@samp{tmp/} stands for the directory @file{/tmp} on your local
1618machine,
1619@end ifset
1620and @samp{@value{tramp-prefix-single-hop}toto@value{tramp-postfix}}
1621might be a host @tramp has detected in your @file{~/.ssh/known_hosts}
1622file (given you're using default method @option{ssh}).
1623
1624If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
1625@samp{@value{tramp-prefix}telnet@value{tramp-postfix-single-hop}}.
1626Next @kbd{@key{TAB}} brings you all machine names @tramp{} detects in
1627your @file{/etc/hosts} file, let's say
1628
1629@example
1630@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}127.0.0.1@value{tramp-postfix} @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}192.168.0.1@value{tramp-postfix}
1631@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}localhost@value{tramp-postfix} @value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia.danann.net@value{tramp-postfix}
1632@value{tramp-prefix-single-hop}telnet@value{tramp-postfix-single-hop}melancholia@value{tramp-postfix}
1633@end example
1634
1635Now you can choose the desired machine, and you can continue to
1636complete file names on that machine.
1637
1638As filename completion needs to fetch the listing of files from the
1639remote machine, this feature is sometimes fairly slow. As @tramp{}
1640does not yet cache the results of directory listing, there is no gain
1641in performance the second time you complete filenames.
1642
1643If the configuration files (@pxref{Customizing Completion}), which
1644@tramp{} uses for analysis of completion, offer user names, those user
1645names will be taken into account as well.
fb7933a3
KG
1646
1647
1648@node Dired
16674e4f 1649@section Dired
92eeeafc 1650@cindex dired
fb7933a3
KG
1651
1652@tramp{} works transparently with dired, enabling you to use this powerful
1653file management tool to manage files on any machine you have access to
1654over the Internet.
1655
fb7933a3 1656If you need to browse a directory tree, Dired is a better choice, at
92eeeafc 1657present, than filename completion. Dired has its own cache mechanism
fb7933a3
KG
1658and will only fetch the directory listing once.
1659
1660
1661@node Bug Reports
1662@chapter Reporting Bugs and Problems
92eeeafc 1663@cindex bug reports
fb7933a3
KG
1664
1665Bugs and problems with @tramp{} are actively worked on by the development
1666team. Feature requests and suggestions are also more than welcome.
1667
1668The @tramp{} mailing list is a great place to get information on working
1669with @tramp{}, solving problems and general discussion and advice on topics
1670relating to the package.
1671
1672The mailing list is at @email{tramp-devel@@mail.freesoftware.fsf.org}.
1673Messages sent to this address go to all the subscribers. This is
1674@emph{not} the address to send subscription requests to.
1675
1676For help on subscribing to the list, send mail to the administrative
1677address, @email{tramp-devel-request@@mail.freesoftware.fsf.org}, with the
1678subject @samp{help}.
1679
1680To report a bug in @tramp{}, you should execute @kbd{M-x tramp-bug}. This
1681will automatically generate a buffer with the details of your system and
1682@tramp{} version.
1683
1684When submitting a bug report, please try to describe in excruciating
1685detail the steps required to reproduce the problem, the setup of the
1686remote machine and any special conditions that exist.
1687
1688If you can identify a minimal test case that reproduces the problem,
1689include that with your bug report. This will make it much easier for the
1690development team to analyze and correct the problem.
1691
1692@node Frequently Asked Questions
1693@chapter Frequently Asked Questions
92eeeafc
KG
1694@cindex frequently asked questions
1695@cindex FAQ
fb7933a3
KG
1696
1697@itemize @bullet
92eeeafc
KG
1698@item
1699Where can I get the latest @tramp{}?
fb7933a3 1700
16674e4f 1701@tramp{} is available under the URL below.
fb7933a3 1702
16674e4f 1703@noindent
b1a2b924 1704@uref{http://savannah.nongnu.org/download/tramp/}
16674e4f
KG
1705
1706@noindent
1707There is also a Savannah project page.
1708
1709@noindent
1710@uref{https://savannah.gnu.org/projects/tramp/}
fb7933a3 1711
92eeeafc
KG
1712@item
1713Which systems does it work on?
fb7933a3
KG
1714
1715The package has been used successfully on Emacs 20 and Emacs 21, as well
1716as XEmacs 21. XEmacs 20 is more problematic, see the notes in
1717@file{tramp.el}. I don't think anybody has really tried it on Emacs 19.
1718
1719The package was intended to work on Unix, and it really expects a
1720Unix-like system on the remote end, but some people seemed to have some
1721success getting it to work on NT Emacs.
1722
abc6be8d
KG
1723There is some informations on @tramp{} on NT at the following URL;
1724many thanks to Joe Stoy for providing the information:
fb7933a3
KG
1725@uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}
1726
1727The above mostly contains patches to old ssh versions; Tom Roche has a
1728Web page with instructions:
1729@uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
1730
1731??? Is the XEmacs info correct?
1732
1733??? Can somebody provide some information for getting it to work on NT
1734Emacs? I think there was some issue with @command{ssh}?
1735
1736
92eeeafc 1737@item
18d6d595
KG
1738I can't stop @value{ftp-package-name} starting with @value{emacs-name}
1739
1740@ifset emacs
1741@value{ftp-package-name} is loaded from @tramp{} automatically if you
1742require a file by the ftp method. Unfortunately, there are some Lisp
1743packages which make @value{ftp-package-name} file name handlers active.
1744You can see it applying @kbd{C-h v file-name-handler-alist}:
1745
1746@example
1747file-name-handler-alist's value is
1748(("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
1749 ("^/[^/:]*[^/:.]:" . ange-ftp-hook-function)
1750 ("^/[^/]*$" . tramp-completion-file-name-handler)
1751 ("\\`/[^/:]+:" . tramp-file-name-handler)
1752 ("\\`/:" . file-name-non-special))
1753@end example
1754
1755Please try to find out which package is responsible for loading
1756@value{ftp-package-name}, and raise a bug report.
fb7933a3 1757
18d6d595
KG
1758A workaround is to require @value{ftp-package-name} before @tramp{} in
1759your @file{~/.emacs}, because @tramp{} cleans up the entries in
1760@code{file-name-handler-alist}:
1761
1762@lisp
1763;; @value{ftp-package-name} temporarily required
1764(require 'ange-ftp)
1765;; @tramp{} cleans up @code{file-name-handler-alist}
1766(require 'tramp)
1767@end lisp
1768@end ifset
1769
1770@ifset xemacs
1771Not all the older versions of @tramp{} supported @value{emacs-name}
1772correctly. The first thing to do is to make sure that you have the
1773latest version of @tramp{} installed.
fb7933a3
KG
1774
1775If you do, please try and find out exactly the conditions required for
18d6d595
KG
1776the @value{ftp-package-name} handlers to fire. If you can, putting a
1777breakpoint on @code{efs-ftp-path} and sending in the stack trace along
1778with your bug report would make it easier for the developers to work out
1779what is going wrong.
1780@end ifset
fb7933a3
KG
1781
1782
92eeeafc
KG
1783@item
1784File name completion does not work with @tramp{}
fb7933a3
KG
1785
1786When you log in to the remote machine, do you see the output of
1787@command{ls} in color? If so, this may be the cause of your problems.
1788
1789@command{ls} outputs @acronym{ANSI} escape sequences that your terminal
18d6d595 1790emulator interprets to set the colors. These escape sequences will
fb7933a3
KG
1791confuse @tramp{} however.
1792
1793In your @file{.bashrc}, @file{.profile} or equivalent on the remote
1794machine you probably have an alias configured that adds the option
1795@option{--color=yes} or @option{--color=auto}.
1796
1797You should remove that alias and ensure that a new login @emph{does not}
18d6d595 1798display the output of @command{ls} in color. If you still cannot use
fb7933a3
KG
1799filename completion, report a bug to the @tramp{} developers.
1800
1801
92eeeafc
KG
1802@item
1803File name completion does not work in large directories
fb7933a3
KG
1804
1805@tramp{} uses globbing for some operations. (Globbing means to use the
1806shell to expand wildcards such as `*.c'.) This might create long
abc6be8d 1807command lines, especially in directories with many files. Some shells
fb7933a3
KG
1808choke on long command lines, or don't cope well with the globbing
1809itself.
1810
1811If you have a large directory on the remote end, you may wish to execute
92eeeafc 1812a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
fb7933a3
KG
1813Note that you must first start the right shell, which might be
1814@command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
1815of those supports tilde expansion.
1816
1817
92eeeafc
KG
1818@item
1819What kinds of systems does @tramp{} work on
fb7933a3
KG
1820
1821@tramp{} really expects the remote system to be a Unix-like system. The
1822local system should preferably be Unix-like, as well, but @tramp{} might
1823work on NT with some tweaking.
1824
1825
92eeeafc
KG
1826@item
1827How can I get notified when @tramp{} file transfers are complete?
fb7933a3
KG
1828
1829The following snippet can be put in your @file{~/.emacs} file. It makes
1830Emacs beep after reading from or writing to the remote host.
1831
1832@lisp
1833(defadvice tramp-handle-write-region
1834 (after tramp-write-beep-advice activate)
1835 " make tramp beep after writing a file."
1836 (interactive)
1837 (beep))
1838(defadvice tramp-handle-do-copy-or-rename-file
1839 (after tramp-copy-beep-advice activate)
1840 " make tramp beep after copying a file."
1841 (interactive)
1842 (beep))
1843(defadvice tramp-handle-insert-file-contents
1844 (after tramp-copy-beep-advice activate)
1845 " make tramp beep after copying a file."
1846 (interactive)
1847 (beep))
1848@end lisp
1849
1850
92eeeafc
KG
1851@item
1852There's this @file{~/.sh_history} file on the remote host which keeps
1853growing and growing. What's that?
fb7933a3
KG
1854
1855Sometimes, @tramp{} starts @code{ksh} on the remote host for tilde
1856expansion. Maybe @code{ksh} saves the history by default. @tramp{}
1857tries to turn off saving the history, but maybe you have to help. For
1858example, you could put this in your @file{.kshrc}:
1859
1860@example
1861if [ -f $HOME/.sh_history ] ; then
1862 /bin/rm $HOME/.sh_history
1863fi
1864if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
1865 unset HISTFILE
1866fi
1867if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
1868 unset HISTSIZE
1869fi
1870@end example
1871
884b79ec
KG
1872
1873@item @tramp{} doesn't transfer strings with more than 500 characters
1874correctly
1875
1876On some few systems, the implementation of @code{process-send-string}
1877seems to be broken for longer strings. This case, you should
1878customize the variable @code{tramp-chunksize} to 500. For a
1879description how to determine whether this is necessary see the
1880documentation of @code{tramp-chunksize}.
1881
fb7933a3
KG
1882@end itemize
1883
1884
1885@c For the developer
1886@node Version Control
1887@chapter The inner workings of remote version control
41bed43c 1888@cindex Version Control
fb7933a3 1889
16674e4f
KG
1890Unlike @value{ftp-package-name}, @tramp{} has full shell access to the
1891remote machine. This makes it possible to provide version control for
1892files accessed under @tramp{}.
fb7933a3
KG
1893
1894The actual version control binaries must be installed on the remote
1895machine, accessible in the directories specified in
1896@var{tramp-remote-path}.
1897
1898This transparent integration with the version control systems is one of
1899the most valuable features provided by @tramp{}, but it is far from perfect.
1900Work is ongoing to improve the transparency of the system.
1901
1902@menu
1903* Version Controlled Files:: Determining if a file is under version control.
1904* Remote Commands:: Executing the version control commands on the remote machine.
1905* Changed workfiles:: Detecting if the working file has changed.
1906* Checking out files:: Bringing the workfile out of the repository.
16674e4f 1907* Miscellaneous Version Control:: Things related to Version Control that don't fit elsewhere.
fb7933a3
KG
1908@end menu
1909
1910
1911@node Version Controlled Files
1912@section Determining if a file is under version control
1913
1914The VC package uses the existence of on-disk revision control master
1915files to determine if a given file is under revision control. These file
1916tests happen on the remote machine through the standard @tramp{} mechanisms.
1917
1918
1919@node Remote Commands
1920@section Executing the version control commands on the remote machine
1921
1922There are no hooks provided by VC to allow intercepting of the version
1923control command execution. The calls occur through the
1924@code{call-process} mechanism, a function that is somewhat more
1925efficient than the @code{shell-command} function but that does not
1926provide hooks for remote execution of commands.
1927
1928To work around this, the functions @code{vc-do-command} and
1929@code{vc-simple-command} have been advised to intercept requests for
1930operations on files accessed via @tramp{}.
1931
1932In the case of a remote file, the @code{shell-command} interface is
1933used, with some wrapper code, to provide the same functionality on the
884b79ec 1934remote machine as would be seen on the local machine.
fb7933a3
KG
1935
1936
1937@node Changed workfiles
1938@section Detecting if the working file has changed
1939
1940As there is currently no way to get access to the mtime of a file on a
1941remote machine in a portable way, the @code{vc-workfile-unchanged-p}
1942function is advised to call an @tramp{} specific function for remote files.
1943
1944The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
1945diff functionality to determine if any changes have occurred between the
1946workfile and the version control master.
1947
1948This requires that a shell command be executed remotely, a process that
1949is notably heavier-weight than the mtime comparison used for local
1950files. Unfortunately, unless a portable solution to the issue is found,
1951this will remain the cost of remote version control.
1952
1953
1954@node Checking out files
1955@section Bringing the workfile out of the repository
1956
1957VC will, by default, check for remote files and refuse to act on them
1958when checking out files from the repository. To work around this
1959problem, the function @code{vc-checkout} knows about @tramp{} files and
1960allows version control to occur.
1961
1962
1963@node Miscellaneous Version Control
1964@section Things related to Version Control that don't fit elsewhere
1965
1966Minor implementation details, &c.
1967
1968@menu
1969* Remote File Ownership:: How VC determines who owns a workfile.
1970* Back-end Versions:: How VC determines what release your RCS is.
1971@end menu
1972
1973
1974@node Remote File Ownership
1975@subsection How VC determines who owns a workfile
1976
1977Emacs provides the @code{user-full-name} function to return the login name
1978of the current user as well as mapping from arbitrary user id values
1979back to login names. The VC code uses this functionality to map from the
1980uid of the owner of a workfile to the login name in some circumstances.
1981
1982This will not, for obvious reasons, work if the remote system has a
1983different set of logins. As such, it is necessary to delegate to the
1984remote machine the job of determining the login name associated with a
1985uid.
1986
1987Unfortunately, with the profusion of distributed management systems such
1988as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
1989reliable and portable method for performing this mapping.
1990
1991Thankfully, the only place in the VC code that depends on the mapping of
1992a uid to a login name is the @code{vc-file-owner} function. This returns
1993the login of the owner of the file as a string.
1994
1995This function has been advised to use the output of @command{ls} on the
1996remote machine to determine the login name, delegating the problem of
1997mapping the uid to the login to the remote system which should know more
1998about it than I do.
1999
2000
2001@node Back-end Versions
2002@subsection How VC determines what release your RCS is
2003
2004VC needs to know what release your revision control binaries you are
2005running as not all features VC supports are available with older
2006versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.
2007
2008The default implementation of VC determines this value the first time it
2009is needed and then stores the value globally to avoid the overhead of
2010executing a process and parsing its output each time the information is
2011needed.
2012
2013Unfortunately, life is not quite so easy when remote version control
2014comes into the picture. Each remote machine may have a different version
2015of the version control tools and, while this is painful, we need to
2016ensure that unavailable features are not used remotely.
2017
2018To resolve this issue, @tramp{} currently takes the sledgehammer
2019approach of making the release values of the revision control tools
2020local to each @tramp{} buffer, forcing VC to determine these values
2021again each time a new file is visited.
2022
2023This has, quite obviously, some performance implications. Thankfully,
2024most of the common operations performed by VC do not actually require
2025that the remote version be known. This makes the problem far less
2026apparent.
2027
2028Eventually these values will be captured by @tramp{} on a system by
2029system basis and the results cached to improve performance.
2030
2031
884b79ec
KG
2032@node Files directories and localnames
2033@chapter How file names, directories and localnames are mangled and managed.
fb7933a3
KG
2034
2035@menu
884b79ec 2036* Localname deconstruction:: Breaking a localname into its components.
fb7933a3
KG
2037@end menu
2038
2039
884b79ec
KG
2040@node Localname deconstruction
2041@section Breaking a localname into its components.
fb7933a3 2042
884b79ec 2043@tramp{} file names are somewhat different, obviously, to ordinary file
fb7933a3 2044names. As such, the lisp functions @code{file-name-directory} and
884b79ec
KG
2045@code{file-name-nondirectory} are overridden within the @tramp{}
2046package.
fb7933a3
KG
2047
2048Their replacements are reasonably simplistic in their approach. They
884b79ec
KG
2049dissect the filename, call the original handler on the localname and
2050then rebuild the @tramp{} file name with the result.
fb7933a3
KG
2051
2052This allows the platform specific hacks in the original handlers to take
884b79ec 2053effect while preserving the @tramp{} file name information.
fb7933a3
KG
2054
2055
2056@node Issues
2057@chapter Debatable Issues and What Was Decided
2058
2059@itemize @bullet
2060@item The uuencode method does not always work.
2061
2062Due to the design of @tramp{}, the encoding and decoding programs need to
2063read from stdin and write to stdout. On some systems, @code{uudecode -o
2064-} will read stdin and write the decoded file to stdout, on other
2065systems @code{uudecode -p} does the same thing. But some systems have
2066uudecode implementations which cannot do this at all---it is not
2067possible to call these uudecode implementations with suitable parameters
2068so that they write to stdout.
2069
2070Of course, this could be circumvented: the @code{begin foo 644} line
2071could be rewritten to put in some temporary file name, then
2072@code{uudecode} could be called, then the temp file could be printed and
2073deleted.
2074
2075But I have decided that this is too fragile to reliably work, so on some
2076systems you'll have to do without the uuencode methods.
2077
2078@item @tramp{} does not work on XEmacs 20.
2079
2080This is because it requires the macro @code{with-timeout} which does not
2081appear to exist in XEmacs 20. I'm somewhat reluctant to add an
2082emulation macro to @tramp{}, but if somebody who uses XEmacs 20 steps
2083forward and wishes to implement and test it, please contact me or the
2084mailing list.
2085
f37fc5a7
KG
2086@item The @tramp{} filename syntax differs between Emacs and XEmacs.
2087
2088The Emacs maintainers wish to use a unified filename syntax for
2089Ange-FTP and @tramp{} so that users don't have to learn a new
2090syntax. It is sufficient to learn some extensions to the old syntax.
2091
2092For the XEmacs maintainers, the problems caused from using a unified
abc6be8d
KG
2093filename syntax are greater than the gains. The XEmacs package system
2094uses EFS for downloading new packages. So, obviously, EFS has to be
2095installed from the start. If the filenames were unified, @tramp{}
f37fc5a7
KG
2096would have to be installed from the start, too.
2097
fb7933a3
KG
2098@end itemize
2099
41bed43c
KG
2100@node Concept Index
2101@comment node-name, next, previous, up
2102@unnumbered Concept Index
2103@printindex cp
2104@contents
fb7933a3
KG
2105@c End of tramp.texi - the TRAMP User Manual
2106@bye
2107
2108@c TODO
2109@c
2110@c * Say something about the .login and .profile files of the remote
2111@c shells.
2112@c * Explain how tramp.el works in principle: open a shell on a remote
2113@c host and then send commands to it.
83fa16cf
KG
2114@c * Mention that bookmarks are a cool feature to go along with Tramp.
2115@c * Make terminology "inline" vs "out-of-band" consistent.
2116@c It seems that "external" is also used instead of "out-of-band".
fb7933a3 2117
16674e4f
KG
2118@c * M. Albinus
2119@c ** Use `filename' resp. `file name' consistently.
2120@c ** Use `host' resp. `machine' consistently.
2121@c ** Consistent small or capitalized words especially in menues.
ab5796a9
MB
2122
2123@ignore
2124 arch-tag: f96dd66e-6dd3-4c92-8d77-9c56205ba808
2125@end ignore