tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resend: ftp & multi-hop?


From: Kai Großjohann
Subject: Re: Resend: ftp & multi-hop?
Date: Sat, 25 Oct 2003 16:17:17 +0200 (MEST)

> -----Original Message-----

I can't remember seeing the original message.  Hm.  I guess it really did
get lost.

> I would like to connect to an ftp server in two hops.  One over `sshx'
> to a server behind a firewall, and thence via ftp to a second server
> inside that firewall.  Now I understand that 'ftp isn't a member of
> `tramp-multi-connection-function-alist', so this isn't supported
> out-of-the-box.
> 
> My question is: how feasible would it be to add it?  I added sshx with
> no troubles.  I then tried ftp with no luck.  A quick look at the
> source indicates that tramp delegates all ftp work to ange-ftp.
> Before I run down a rabbit hole, is this going to present a problem if
> I want to use ftp as a hop in a multi-hop method?

There is no predefined hook where you can just add your feature.  I tried to
make Tramp modular (and Michael succeeded in it ;-) so that some extensions
are easily possible.  I've never thought about doing what you want to do,
though, so it would be difficult.

In order to explain the multi-hop methods I first need to explain the inline
methods.  Whereas out-of-band methods invoke an extra program such as scp or
rsync to transfer the files, inline methods just invoke "mimencode -b
/the/file" in the remote shell.  This spews the file contents into the shell
buffer, where Tramp then picks them up.  It undoes the base64 encoding and 
presents
you the result in a buffer.  For saving, it works similarly: Tramp sends
"mimencode -u -b > /the/file <<EOF" to the remote end, then locally
base64-encodes the buffer contents, then sends the result line-by-line to the 
remote
shell command.  After the last line, Tramp sends "EOF", and that causes the
remote mimencode program to write the file.

Now the magic of multi-hop methods is more cheating than actual magic: when
you establish a connection, Tramp just sends commands to the remote end which
cause it to log in to another host, and also Tramp deals with password
prompts and so on.  After Tramp got a shell on the target system, the inline
method for transferring the file contents will work just fine.

Getting this to work with out of band methods is a quite involved thing. 
Say you log in from your local host via hops A, B, C to the target system T. 
Now say you want to save a file.  This means that Tramp needs to write it to a
local file.  Then it uses the scp-like command to send it to A.  Then Tramp
needs a shell on A, in order to invoke the scp command for sending the file
from A to B.  Another shell on B is needed for sending it to C, and a third
shell on C is needed for sending it from there to T.

So whereas multi-hop-with-inline just needs a single shell, doing multi-hop
with out-of-band methods requires O(n) shells where n is the number of hops.

FTP is similar to an out-of-band method because the protocol has a control
connection (for sending commands like cd and dir) and then establishes
additional data connections for actual file transfer.

And after you've extended Tramp to deal with multi-hop out-of-band
connections, you still haven't adapted the whole thing to Ange-FTP.  That's 
another
hard piece of work.

But maybe the good news is that Ange-FTP itself supports a so-called
"gateway" feature.  I never really grokked what that does, but it seems you can 
tell
it to rsh to another host to invoke ftp from there.  I think Ange-FTP can
then use rcp to transfer the files between the local system and the gateway
host.  Ange-FTP stems from the before-SSH times, but I guess that whatever its
methods are for rsh/rcp, they can be adapted to use ssh/scp instead.

I hope it goes without saying that I would be most delighted if you were to
start working on making Tramp support multi-hop out-of-band connections ;-) 
Or if you were to integrate Tramp and Ange-FTP better.

Does this help at all?

Kai

-- 
I like BOTH kinds of music!

NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++





reply via email to

[Prev in Thread] Current Thread [Next in Thread]