Idea for feature recursive ssh: "scp file user1 at gateway:user2 at server:"

Darren Tucker dtucker at zip.com.au
Wed May 16 20:23:01 EST 2012


On Wed, May 16, 2012 at 11:32:17AM +0200, Michael Haggerty wrote:
> [I sent this email to the list in January but haven't seen it
> appear. Maybe it didn't get through moderation?]
> 
> How many times have I typed in one window
> 
>     ssh -L 8022:server:22 user1 at gateway
> 
> only so that I can type (in another window!)
> 
>     scp -P 8022 file user2 at localhost:

You want ProxyCommand + ssh -W.  Try this:

ssh -o 'ProxyCommand ssh -W user2 at gateway:%p' user2 at gateway

or the equivalent in ~/.ssh/config

Host server
	ProxyCommand ssh -W %h:%p server
	User user2

Host gateway
	User user1

Basically, you're using "ssh -W" (aka "netcat mode") as a ProxyCommand.
This logs into "gateway", then establishes a TCP port forwarding and
passes the traffic over stdin/stdout.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list