Rsync through an intermediate server (2 hop)hacks

When you utilize a bastion server as an entry point to a remote it’s useful to rsync through an intermediate jump server which saves unnecessary ssh and temporary files on the intermediate host.

rsync -a -e "ssh -A -J user@intermediate-host" local_path user@destination-host:/remote/path
+-----------------+           +-----------------------+        +----------------------+
|                 |           |                       |        |                      |
|                 |           |  intermediate-host    |        |                      |
|   local host    |           |                       |        |   destination-host   |
|   /local_path   +--------------------------------------------+   /remote/path       |
|                 |           |                       |        |                      |
+-----------------+           +-----------------------+        +----------------------+