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

Michael Haggerty mhagger at alum.mit.edu
Thu May 17 02:54:42 EST 2012


On 05/16/2012 12:23 PM, Darren Tucker wrote:
> 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

Yikes, that's not very obvious.  Even now that you've shown me the 
necessary options, it's quite difficult to figure out--but I guess your 
command needs to be corrected to

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

> or the equivalent in ~/.ssh/config
>
> Host server
> 	ProxyCommand ssh -W %h:%p server
> 	User user2
>
> Host gateway
> 	User user1

And shouldn't that be

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

Host gateway
	User user1

?  It's good that there is a solution, but I think that these commands 
are too obscure and cumbersome to use on a daily basis.  So it would 
still be great to have a shorthand for multi-hop connections such as the 
one that I suggested or the --via or host,host: suggestions that were 
made in the mailing list thread that Saku Ytti pointed out.

Michael

-- 
Michael Haggerty
mhagger at alum.mit.edu
http://softwareswirl.blogspot.com/


More information about the openssh-unix-dev mailing list