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