I can connect via ssh to two hosts, say host1 and host2 and I need to copy files from host1 to host2 via rsync
.
I know I can realize this first copying files from host1 to localhost and then from localhost to host2 or perform simple copy via scp -3 <user1@host1:/file_path1> <user2@host2:/file_path2>
, but my goal is test ssh tunnel via rsync
.
Someone can help me?
Extra:
I've read about ssh tunnel, but can't reach my goal... probably there's something I've don't understood. For example if I run
$ ssh -L 9999:host2:22 user_host1@host1
this means: map my local port 9999 to port 22 of host2 and connect to host1 as user user_host1 but... with this mapping what's the purpose of connect to host1 ?