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