218 |
@chapter An overview of @value{tramp} |
@chapter An overview of @value{tramp} |
219 |
@cindex overview |
@cindex overview |
220 |
|
|
221 |
After the installation of @value{tramp} into your @value{emacsname}, you |
After the installation of @value{tramp} into your @value{emacsname}, |
222 |
will be able to access files on remote machines as though they were |
you will be able to access files on remote machines as though they |
223 |
local. Access to the remote file system for editing files, version |
were local. Access to the remote file system for editing files, |
224 |
control, and @command{dired} are transparently enabled. |
version control, and @code{dired} are transparently enabled. |
225 |
|
|
226 |
Your access to the remote machine can be with the @command{rsh}, |
Your access to the remote machine can be with the @command{rsh}, |
227 |
@command{rlogin}, @command{telnet} programs or with any similar |
@command{rlogin}, @command{telnet} programs or with any similar |
289 |
goes into a buffer. |
goes into a buffer. |
290 |
|
|
291 |
@item |
@item |
292 |
The remote host may prompt for a login name (for @command{telnet}). The |
The remote host may prompt for a login name (for @command{telnet}). |
293 |
login name is given in the file name, so @value{tramp} sends the login name and |
The login name is given in the file name, so @value{tramp} sends the |
294 |
a newline. |
login name and a newline. |
295 |
|
|
296 |
@item |
@item |
297 |
The remote host may prompt for a password or pass phrase (for |
The remote host may prompt for a password or pass phrase (for |
365 |
Again, @value{tramp} transfers the file contents to the remote host either |
Again, @value{tramp} transfers the file contents to the remote host either |
366 |
inline or out-of-band. This is the reverse of what happens when reading |
inline or out-of-band. This is the reverse of what happens when reading |
367 |
the file. |
the file. |
|
|
|
368 |
@end itemize |
@end itemize |
369 |
|
|
370 |
I hope this has provided you with a basic overview of what happens |
I hope this has provided you with a basic overview of what happens |
652 |
@item @option{sshx} |
@item @option{sshx} |
653 |
@cindex method sshx |
@cindex method sshx |
654 |
@cindex sshx method |
@cindex sshx method |
|
@cindex Cygwin (with sshx method) |
|
655 |
|
|
656 |
As you would expect, this is similar to @option{ssh}, only a little |
As you would expect, this is similar to @option{ssh}, only a little |
657 |
different. Whereas @option{ssh} opens a normal interactive shell on |
different. Whereas @option{ssh} opens a normal interactive shell on |
672 |
This is also useful for Windows users where @command{ssh}, when |
This is also useful for Windows users where @command{ssh}, when |
673 |
invoked from an @value{emacsname} buffer, tells them that it is not |
invoked from an @value{emacsname} buffer, tells them that it is not |
674 |
allocating a pseudo tty. When this happens, the login shell is wont |
allocating a pseudo tty. When this happens, the login shell is wont |
675 |
to not print any shell prompt, which confuses @value{tramp} mightily. For |
to not print any shell prompt, which confuses @value{tramp} mightily. |
676 |
reasons unknown, some Windows ports for @command{ssh} (maybe the |
For reasons unknown, some Windows ports for @command{ssh} require the |
677 |
Cygwin one) require the doubled @samp{-t} option. |
doubled @samp{-t} option. |
678 |
|
|
679 |
This supports the @samp{-p} kludge. |
This supports the @samp{-p} kludge. |
680 |
|
|
815 |
@cindex scpx method |
@cindex scpx method |
816 |
@cindex scp (with scpx method) |
@cindex scp (with scpx method) |
817 |
@cindex ssh (with scpx method) |
@cindex ssh (with scpx method) |
|
@cindex Cygwin (with scpx method) |
|
818 |
|
|
819 |
As you would expect, this is similar to @option{scp}, only a little |
As you would expect, this is similar to @option{scp}, only a little |
820 |
different. Whereas @option{scp} opens a normal interactive shell on |
different. Whereas @option{scp} opens a normal interactive shell on |
829 |
invoked from an @value{emacsname} buffer, tells them that it is not |
invoked from an @value{emacsname} buffer, tells them that it is not |
830 |
allocating a pseudo tty. When this happens, the login shell is wont |
allocating a pseudo tty. When this happens, the login shell is wont |
831 |
to not print any shell prompt, which confuses @value{tramp} mightily. |
to not print any shell prompt, which confuses @value{tramp} mightily. |
|
Maybe this applies to the Cygwin port of SSH. |
|
832 |
|
|
833 |
This method supports the @samp{-p} hack. |
This method supports the @samp{-p} hack. |
834 |
|
|
1021 |
'("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n")) |
'("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n")) |
1022 |
@end lisp |
@end lisp |
1023 |
|
|
1024 |
Now you can use an @code{sshf} hop which connects to port 4400 instead of |
Now you can use an @option{sshf} hop which connects to port 4400 instead of |
1025 |
the standard port. |
the standard port. |
1026 |
|
|
1027 |
|
|
1070 |
environment you will use them in and, especially when used over the |
environment you will use them in and, especially when used over the |
1071 |
Internet, the security implications of your preferred method. |
Internet, the security implications of your preferred method. |
1072 |
|
|
1073 |
The @command{rsh} and @command{telnet} methods send your password as |
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 transferring |
plain text as you log in to the remote machine, as well as |
1075 |
the files in such a way that the content can easily be read from other |
transferring the files in such a way that the content can easily be |
1076 |
machines. |
read from other machines. |
1077 |
|
|
1078 |
If you need to connect to remote systems that are accessible from the |
If you need to connect to remote systems that are accessible from the |
1079 |
Internet, you should give serious thought to using @command{ssh} based |
Internet, you should give serious thought to using @option{ssh} based |
1080 |
methods to connect. These provide a much higher level of security, |
methods to connect. These provide a much higher level of security, |
1081 |
making it a non-trivial exercise for someone to obtain your password or |
making it a non-trivial exercise for someone to obtain your password |
1082 |
read the content of the files you are editing. |
or read the content of the files you are editing. |
1083 |
|
|
1084 |
|
|
1085 |
@subsection Which method is the right one for me? |
@subsection Which method is the right one for me? |
1097 |
to edit mostly small files. |
to edit mostly small files. |
1098 |
|
|
1099 |
I guess that these days, most people can access a remote machine by |
I guess that these days, most people can access a remote machine by |
1100 |
using @code{ssh}. So I suggest that you use the @code{ssh} method. |
using @command{ssh}. So I suggest that you use the @option{ssh} |
1101 |
So, type @kbd{C-x C-f |
method. So, type @kbd{C-x C-f |
1102 |
@value{prefix}ssh@value{postfixsinglehop}root@@otherhost@value{postfix}/etc/motd |
@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. |
@key{RET}} to edit the @file{/etc/motd} file on the other host. |
1104 |
|
|
1105 |
If you can't use @code{ssh} to log in to the remote host, then select a |
If you can't use @option{ssh} to log in to the remote host, then |
1106 |
method that uses a program that works. For instance, Windows users |
select a method that uses a program that works. For instance, Windows |
1107 |
might like the @code{plink} method which uses the PuTTY implementation |
users might like the @option{plink} method which uses the PuTTY |
1108 |
of @code{ssh}. Or you use Kerberos and thus like @code{krlogin}. |
implementation of @command{ssh}. Or you use Kerberos and thus like |
1109 |
|
@option{krlogin}. |
1110 |
|
|
1111 |
For the special case of editing files on the local host as another |
For the special case of editing files on the local host as another |
1112 |
user, see the @code{su} or @code{sudo} method. It offers shortened |
user, see the @option{su} or @option{sudo} methods. They offer |
1113 |
syntax for the @samp{root} account, like |
shortened syntax for the @samp{root} account, like |
1114 |
@file{@value{prefix}su@value{postfixsinglehop}@value{postfix}/etc/motd}. |
@file{@value{prefix}su@value{postfixsinglehop}@value{postfix}/etc/motd}. |
1115 |
|
|
1116 |
People who edit large files may want to consider @code{scp} instead of |
People who edit large files may want to consider @option{scp} instead |
1117 |
@code{ssh}, or @code{pscp} instead of @code{plink}. These out-of-band |
of @option{ssh}, or @option{pscp} instead of @option{plink}. These |
1118 |
methods are faster than inline methods for large files. Note, however, |
out-of-band methods are faster than inline methods for large files. |
1119 |
that out-of-band methods suffer from some limitations. Please try |
Note, however, that out-of-band methods suffer from some limitations. |
1120 |
first whether you really get a noticeable speed advantage from using an |
Please try first whether you really get a noticeable speed advantage |
1121 |
out-of-band method! Maybe even for large files, inline methods are |
from using an out-of-band method! Maybe even for large files, inline |
1122 |
fast enough. |
methods are fast enough. |
1123 |
|
|
1124 |
|
|
1125 |
@node Customizing Methods |
@node Customizing Methods |
1362 |
be inconvenient because you have to invest a lot of effort into shell |
be inconvenient because you have to invest a lot of effort into shell |
1363 |
setup before you can begin to use @value{tramp}. |
setup before you can begin to use @value{tramp}. |
1364 |
|
|
1365 |
The package, therefore, pursues a combined approach. It tries to figure |
The package, therefore, pursues a combined approach. It tries to |
1366 |
out some of the more common setups, and only requires you to avoid |
figure out some of the more common setups, and only requires you to |
1367 |
really exotic stuff. For example, it looks through a list of |
avoid really exotic stuff. For example, it looks through a list of |
1368 |
directories to find some programs on the remote host. And also, it |
directories to find some programs on the remote host. And also, it |
1369 |
knows that it is not obvious how to check whether a file exists, and |
knows that it is not obvious how to check whether a file exists, and |
1370 |
therefore it tries different possibilities. (On some hosts and shells, |
therefore it tries different possibilities. (On some hosts and |
1371 |
the command @code{test -e} does the trick, on some hosts the shell |
shells, the command @command{test -e} does the trick, on some hosts |
1372 |
builtin doesn't work but the program @code{/usr/bin/test -e} or |
the shell builtin doesn't work but the program @command{/usr/bin/test |
1373 |
@code{/bin/test -e} works. And on still other hosts, @code{ls -d} is |
-e} or @command{/bin/test -e} works. And on still other hosts, |
1374 |
the right way to do this.) |
@command{ls -d} is the right way to do this.) |
1375 |
|
|
1376 |
Below you find a discussion of a few things that @value{tramp} does not deal |
Below you find a discussion of a few things that @value{tramp} does not deal |
1377 |
with, and that you therefore have to set up correctly. |
with, and that you therefore have to set up correctly. |
1406 |
@code{shell-prompt-pattern}, which is reported to work well in many |
@code{shell-prompt-pattern}, which is reported to work well in many |
1407 |
circumstances. |
circumstances. |
1408 |
|
|
1409 |
@item @code{tset} and other questions |
@item @command{tset} and other questions |
1410 |
@cindex Unix command tset |
@cindex Unix command tset |
1411 |
@cindex tset Unix command |
@cindex tset Unix command |
1412 |
|
|
1413 |
Some people invoke the @code{tset} program from their shell startup |
Some people invoke the @command{tset} program from their shell startup |
1414 |
scripts which asks the user about the terminal type of the shell. |
scripts which asks the user about the terminal type of the shell. |
1415 |
Maybe some shells ask other questions when they are started. @value{tramp} |
Maybe some shells ask other questions when they are started. @value{tramp} |
1416 |
does not know how to answer these questions. There are two approaches |
does not know how to answer these questions. There are two approaches |
1440 |
@item Non-Bourne commands in @file{.profile} |
@item Non-Bourne commands in @file{.profile} |
1441 |
|
|
1442 |
After logging in to the remote host, @value{tramp} issues the command |
After logging in to the remote host, @value{tramp} issues the command |
1443 |
@code{exec /bin/sh}. (Actually, the command is slightly different.) |
@command{exec /bin/sh}. (Actually, the command is slightly |
1444 |
When @code{/bin/sh} is executed, it reads some init files, such as |
different.) When @command{/bin/sh} is executed, it reads some init |
1445 |
@file{~/.shrc} or @file{~/.profile}. |
files, such as @file{~/.shrc} or @file{~/.profile}. |
1446 |
|
|
1447 |
Now, some people have a login shell which is not @code{/bin/sh} but a |
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 |
Bourne-ish shell such as bash or ksh. Some of these people might put |
1449 |
their shell setup into the files @code{~/.shrc} or @code{~/.profile}. |
their shell setup into the files @file{~/.shrc} or @file{~/.profile}. |
1450 |
This way, it is possible for non-Bourne constructs to end up in those |
This way, it is possible for non-Bourne constructs to end up in those |
1451 |
files. Then, @code{exec /bin/sh} might cause the Bourne shell to barf |
files. Then, @command{exec /bin/sh} might cause the Bourne shell to |
1452 |
on those constructs. |
barf on those constructs. |
1453 |
|
|
1454 |
As an example, imagine somebody putting @code{export FOO=bar} into the |
As an example, imagine somebody putting @command{export FOO=bar} into |
1455 |
file @file{~/.profile}. The standard Bourne shell does not understand |
the file @file{~/.profile}. The standard Bourne shell does not |
1456 |
this syntax and will emit a syntax error when it reaches this line. |
understand this syntax and will emit a syntax error when it reaches |
1457 |
|
this line. |
1458 |
|
|
1459 |
Another example is the tilde (@code{~}) character, say when adding |
Another example is the tilde (@code{~}) character, say when adding |
1460 |
@file{~/bin} to @code{$PATH}. Many Bourne shells will not expand this |
@file{~/bin} to @code{$PATH}. Many Bourne shells will not expand this |
1465 |
|
|
1466 |
Well, one possibility is to make sure that everything in @file{~/.shrc} |
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 |
and @file{~/.profile} on all remote hosts is Bourne-compatible. In the |
1468 |
above example, instead of @code{export FOO=bar}, you might use |
above example, instead of @command{export FOO=bar}, you might use |
1469 |
@code{FOO=bar; export FOO} instead. |
@command{FOO=bar; export FOO} instead. |
1470 |
|
|
1471 |
The other possibility is to put your non-Bourne shell setup into some |
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} |
other files. For example, bash reads the file @file{~/.bash_profile} |
1474 |
aficionados just rename their @file{~/.profile} to |
aficionados just rename their @file{~/.profile} to |
1475 |
@file{~/.bash_profile} on all remote hosts, and Bob's your uncle. |
@file{~/.bash_profile} on all remote hosts, and Bob's your uncle. |
1476 |
|
|
1477 |
The @value{tramp} developers would like to circumvent this problem, so if you |
The @value{tramp} developers would like to circumvent this problem, so |
1478 |
have an idea about it, please tell us. However, we are afraid it is not |
if you have an idea about it, please tell us. However, we are afraid |
1479 |
that simple: before saying @code{exec /bin/sh}, @value{tramp} does not know |
it is not that simple: before saying @command{exec /bin/sh}, |
1480 |
which kind of shell it might be talking to. It could be a Bourne-ish |
@value{tramp} does not know which kind of shell it might be talking |
1481 |
shell like ksh or bash, or it could be a csh derivative like tcsh, or |
to. It could be a Bourne-ish shell like ksh or bash, or it could be a |
1482 |
it could be zsh, or even rc. If the shell is Bourne-ish already, then |
csh derivative like tcsh, or it could be zsh, or even rc. If the |
1483 |
it might be prudent to omit the @code{exec /bin/sh} step. But how to |
shell is Bourne-ish already, then it might be prudent to omit the |
1484 |
find out if the shell is Bourne-ish? |
@command{exec /bin/sh} step. But how to find out if the shell is |
1485 |
|
Bourne-ish? |
1486 |
|
|
1487 |
@end table |
@end table |
1488 |
|
|
1629 |
|
|
1630 |
@cindex method sshx with Cygwin |
@cindex method sshx with Cygwin |
1631 |
@cindex sshx method with Cygwin |
@cindex sshx method with Cygwin |
1632 |
If you use the Cygwin installation of ssh (you have to explicitly select |
The recent Cygwin installation of @command{ssh} works only with a |
1633 |
it in the installer), then it should work out of the box to just select |
Cygwinized @value{emacsname}. You can check it by typing @kbd{M-x |
1634 |
@code{sshx} as the connection method. You can find information about |
eshell}, and starting @kbd{ssh test.machine}. The problem is evident |
1635 |
setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}. |
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/}. |
1645 |
|
|
1646 |
@cindex method scpx with Cygwin |
@cindex method scpx with Cygwin |
1647 |
@cindex scpx method with Cygwin |
@cindex scpx method with Cygwin |
1648 |
If you wish to use the @code{scpx} connection method, then you might |
If you wish to use the @option{scpx} connection method, then you might |
1649 |
have the problem that @value{emacsname} calls @code{scp} with a |
have the problem that @value{emacsname} calls @command{scp} with a |
1650 |
Windows filename such as @code{c:/foo}. The Cygwin version of |
Windows filename such as @code{c:/foo}. The Cygwin version of |
1651 |
@code{scp} does not know about Windows filenames and interprets this |
@command{scp} does not know about Windows filenames and interprets this |
1652 |
as a remote filename on the host @code{c}. |
as a remote filename on the host @code{c}. |
1653 |
|
|
1654 |
One possible workaround is to write a wrapper script for @code{scp} |
One possible workaround is to write a wrapper script for @option{scp} |
1655 |
which converts the Windows filename to a Cygwinized filename. |
which converts the Windows filename to a Cygwinized filename. |
1656 |
|
|
|
I guess that another workaround is to run @value{emacsname} under |
|
|
Cygwin, or to run a Cygwinized @value{emacsname}. |
|
|
|
|
1657 |
@cindex Cygwin and ssh-agent |
@cindex Cygwin and ssh-agent |
1658 |
@cindex SSH_AUTH_SOCK and @value{emacsname} on Windows |
@cindex SSH_AUTH_SOCK and @value{emacsname} on Windows |
1659 |
If you want to use either @code{ssh} based method on Windows, then you |
If you want to use either @option{ssh} based method on Windows, then |
1660 |
might encounter problems with @code{ssh-agent}. Using this program, |
you might encounter problems with @command{ssh-agent}. Using this |
1661 |
you can avoid typing the pass-phrase every time you log in. However, |
program, you can avoid typing the pass-phrase every time you log in. |
1662 |
if you start @value{emacsname} from a desktop shortcut, then the |
However, if you start @value{emacsname} from a desktop shortcut, then |
1663 |
environment variable @code{SSH_AUTH_SOCK} is not set and so |
the environment variable @code{SSH_AUTH_SOCK} is not set and so |
1664 |
@value{emacsname} and thus @value{tramp} and thus @code{ssh} and |
@value{emacsname} and thus @value{tramp} and thus @command{ssh} and |
1665 |
@code{scp} started from @value{tramp} cannot communicate with |
@command{scp} started from @value{tramp} cannot communicate with |
1666 |
@code{ssh-agent}. It works better to start @value{emacsname} from |
@command{ssh-agent}. It works better to start @value{emacsname} from |
1667 |
the shell. |
the shell. |
1668 |
|
|
1669 |
If anyone knows how to start @code{ssh-agent} under Windows in such a |
If anyone knows how to start @command{ssh-agent} under Windows in such a |
1670 |
way that desktop shortcuts can profit, please holler. I don't really |
way that desktop shortcuts can profit, please holler. I don't really |
1671 |
know anything at all about Windows@dots{} |
know anything at all about Windows@dots{} |
1672 |
|
|
2113 |
There's this @file{~/.sh_history} file on the remote host which keeps |
There's this @file{~/.sh_history} file on the remote host which keeps |
2114 |
growing and growing. What's that? |
growing and growing. What's that? |
2115 |
|
|
2116 |
Sometimes, @value{tramp} starts @code{ksh} on the remote host for tilde |
Sometimes, @value{tramp} starts @command{ksh} on the remote host for |
2117 |
expansion. Maybe @code{ksh} saves the history by default. @value{tramp} |
tilde expansion. Maybe @command{ksh} saves the history by default. |
2118 |
tries to turn off saving the history, but maybe you have to help. For |
@value{tramp} tries to turn off saving the history, but maybe you have |
2119 |
example, you could put this in your @file{.kshrc}: |
to help. For example, you could put this in your @file{.kshrc}: |
2120 |
|
|
2121 |
@example |
@example |
2122 |
if [ -f $HOME/.sh_history ] ; then |
if [ -f $HOME/.sh_history ] ; then |
2321 |
@itemize @bullet |
@itemize @bullet |
2322 |
@item The uuencode method does not always work. |
@item The uuencode method does not always work. |
2323 |
|
|
2324 |
Due to the design of @value{tramp}, the encoding and decoding programs need to |
Due to the design of @value{tramp}, the encoding and decoding programs |
2325 |
read from stdin and write to stdout. On some systems, @code{uudecode -o |
need to read from stdin and write to stdout. On some systems, |
2326 |
-} will read stdin and write the decoded file to stdout, on other |
@command{uudecode -o -} will read stdin and write the decoded file to |
2327 |
systems @code{uudecode -p} does the same thing. But some systems have |
stdout, on other systems @command{uudecode -p} does the same thing. |
2328 |
uudecode implementations which cannot do this at all---it is not |
But some systems have uudecode implementations which cannot do this at |
2329 |
possible to call these uudecode implementations with suitable parameters |
all---it is not possible to call these uudecode implementations with |
2330 |
so that they write to stdout. |
suitable parameters so that they write to stdout. |
2331 |
|
|
2332 |
Of course, this could be circumvented: the @code{begin foo 644} line |
Of course, this could be circumvented: the @code{begin foo 644} line |
2333 |
could be rewritten to put in some temporary file name, then |
could be rewritten to put in some temporary file name, then |
2334 |
@code{uudecode} could be called, then the temp file could be printed and |
@command{uudecode} could be called, then the temp file could be |
2335 |
deleted. |
printed and deleted. |
2336 |
|
|
2337 |
But I have decided that this is too fragile to reliably work, so on some |
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. |
systems you'll have to do without the uuencode methods. |
2373 |
|
|
2374 |
In case of unified filenames, all @value{emacsname} download sites |
In case of unified filenames, all @value{emacsname} download sites |
2375 |
are added to @code{tramp-default-method-alist} with default method |
are added to @code{tramp-default-method-alist} with default method |
2376 |
@code{ftp} @xref{Default Method}. These settings shouldn't be touched |
@option{ftp} @xref{Default Method}. These settings shouldn't be touched |
2377 |
for proper working of the @value{emacsname} package system. |
for proper working of the @value{emacsname} package system. |
2378 |
|
|
2379 |
The syntax for unified filenames is described in the @value{tramp} manual |
The syntax for unified filenames is described in the @value{tramp} manual |
2380 |
for @value{emacsothername}. |
for @value{emacsothername}. |
2381 |
@end ifset |
@end ifset |
|
|
|
2382 |
@end itemize |
@end itemize |
2383 |
|
|
2384 |
@node Concept Index |
@node Concept Index |