28 Aug 2015   devops

You can rsync over a custom port for cases when you have custom ssh tunnels setup using rsyncโ€™s -e flag. The -e flag tells rsync to use a specific shell, in this case itโ€™s still ssh, but with the addition of the -p flag.

Setup a custom tunnel

ssh -N -L 2222: user@remote-machine

Use rsync over the custom tunnel

rsync -avz -e 'ssh -p 2222' localhost:/files /myfiles