ssh to target, scp back to source in same session without name resolution

Jon Peatfield J.S.Peatfield at
Wed Apr 13 10:10:10 EST 2005

On Wed, 13 Apr 2005, Peter Stuge wrote:

> On Tue, Apr 12, 2005 at 08:43:23PM +0200, lars wrote:
> > I ssh to the target host on the internet,
> > look for and find these files/directories
> > (but I don't want to open a second session for scp and
> > I can't resolve the name of my source host behind the firewall),
> > and then I'd like to copy those files back to my source host,
> > within the same encrypted session.
> > 
> > Do you understand what I mean?
> > 
> > I don't think this is possible at the moment,
> > unless I haven't read the manual well enough.
> Should be possible using connection sharing. See -S in ssh(1) and
> ControlMaster/ControlPath in ssh_config(5) and check mailing list
> archive the last few months.

One should also be able to do what was requested using good old port
forwarding  e.g.

  on-client>           ssh -2 -R10022:localhost:22  far-away-server
  on-far-away-server>  scp -o 'port 10022' /etc/motd localhost:/tmp/


There are issues to do with clashing keys (for localhost for example), and
picking a suitable pseudo-random-port to forward but they can be worked
round.  Of course running ssh-over-ssh has an overhead but...

 -- Jon

More information about the openssh-unix-dev mailing list