Transferring file to local machine when SSHing into a foreign box

Peter Stuge peter at stuge.se
Tue May 15 02:01:13 EST 2012


Ángel González wrote:
> > A further variant on this is where on the remote system a file
> > transfer is prepared with the semantics of the proposed cp2local
> > command, but no transfer begins until an explicit ~C command (or
> > perhaps ~D for download) is entered on the client to actually perform
> > the transfer. There will be no notification from the client that a
> > transfer is pending, because in fact nothing is pending, the transfer
> > has only been prepared on the remote side, and will still be
> > initiated only by the client, just that on the remote server there is
> > now the marker running which identifies what should be transfered.
> >
> > A technical problem still remains; how all this should work in terms
> > of the SSH protocol and what exactly the marker command (cp2local)
> > does.
> 
> I have been considering a variant of this, where you use a ~command.
> ~C is already taken, but if could be eg. ~F (for transfering *f*iles).

I was not proposing using ~C as a command since it is obviously
taken, but either adding a command that needs to be typed into the
~C command line, or perhaps using ~D as a shortcut to receive a file.
~U would be the corresponding upload command. There are lots of
variations, ~G(et) ~P(ut), ~S(end) ~R(eceive), and so on.


> So when you typed ~F the client opens a sftp channel over the same
> connection, and shows you a tree view of files and folders to
> browse/download.

Now you are reinventing an SFTP user interface. I think this may be
going too far for OpenSSH. I think it's bad enough that the SFTP
protocol has to be added to the ssh client..

I agree strongly that a filexfer channel is what must be used to
actually perform the transfer.

On Linux it's easy to get the shell's cwd: /proc/childpid/cwd but
what is the situation like on other systems? Unless there is a
portable solution this feature can't really be taken seriously
IMO.

Also, this is a very different user interface than what was
originally requested, and which I think is what makes the most sense.
The question of how exactly the cp2local command will IPC to
sftp-server what file to transfer remains to be solved.


> If you were on Windows, it could be equivalent to being on a PuTTY
> session, and on that action getting a WinSCP spawned (reusing the
> connection).

IMO having an sftp client reuse a connection is a different feature
than requested feature, whose purpose is to save time by being able
to transfer one or more files from remote shell to local filesystem
with very little user interaction.


//Peter


More information about the openssh-unix-dev mailing list