I need to transfer around 4.2 GB of files from my local computer
to a server B
. However to ssh into server B, I need to ssh into server A
.
Currently I'm copying files from my local computer
to server A and then from server A
to server B
.
So the flow goes like this:
rsync -avz --del ~/Desktop/abc/ <my-user-name>@<server-A>:~/abc
rsync -avz --del ~/Desktop/abc/ <my-user-name>@<server-B>:~/abc
This is slow and copies 4.2 gb of data two times instead of one!
Can I transfer files with rsync
from my local computer to directly server B
?
You can always use ssh
with proxy command, which allows you to transfer files transparently. Using this config (~/.ssh/config):
Host <server-A>
User <user-A>
Host <server-B>
User <user-B>
ProxyCommand ssh <server-A> -W %h:%p
You can call your rsync:
rsync -avz --del ~/Desktop/abc/ <server-B>:~/abc
The data will be only "routed" over the middle host.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With