RSync + SSH tunneling through firewall

Stefaan Lhermitte stefaan.lhermitte at
Wed Sep 8 10:18:31 GMT 2004

Indeed, I want to:
* to start rsync session A->C
* cannot establish ssh session A->C (firewall)
* but can establish ssh session A->B and B->C

I think I understand the ssh hop. If I'm correct. I make a script file 
ssh-b that I subsequently invoke in the rsync command (./ssh-b).

Unfortunately I still have a question concerning the ssh-b script.
I have put:

exec ssh myname at host-B ssh "$@"

What stands the "$@" for?
When I run the ssh-b script and enter my password for host-B I get the 
--help printout on my screen?
I assume I have to write something like:

exec ssh myname at host-B ssh myname at host-C

But then I get the error:
Pseudo terminal will not be allocated becausestdin is not a terminal.
Permission denied.

Thanx for your help so far. It already helped a lot.


Andrzej Filip wrote:

> Stefaan Lhermitte wrote:
>>   I tried to connect the tunnel with another port number. When I use 
>> port number 22 instead of 873 I can telnet to C from B.
>> When I telnet I get  "SSH-1.99-OpenSSH_3.9p1."
>> Subsequently I ran: ssh -v -L 22:C-computer:22 myname at B-computer
>> When I run now the rsync command:
>> rsync -v /cygdrive/d/folder/
>> I get the error: "failed to connect to Connection refused."
>> When I run:
>> rsync -v --port=22 /cygdrive/d/folder/
>> I get the error "server sent SSH-1.99-OpenSSH_3.9p1 rather than 
>> greeting"
>> I assume it is a problem associated with the telnet command. Can 
>> anyone help?
> As I understand:
> * you want to start rsync session A->C
> * you can not establish ssh session A->C (firewall)
> * you can establish ssh session A->B and B->C
> Try to use "extra ssh hop" script:
> 1) Create ssh-b script on host A:
> #!/bin/sh
> exec ssh _host_B_ ssh "$@" 

> 2) Use the above sctipt in rsync session
> rsync -e ./ssh-b ....

More information about the rsync mailing list