I'm trying to run an rsync through a bastion host onto an SSH server that listens on a non-standard port, like this:
Source Host -> Bastion Host -> Destination Host (sshd on non-standard port)
I can get onto the destination host via the Bastion box using this:
ssh -o ProxyCommand="ssh -W %h:%p admin@bastion-host" user@destination-host
But this gets me onto the "default" SSH server, running on port 22, and not the one I want to get to, which, for sake of argument, is running on port 12345.
If I want to rsync using the non-standard port, the examples I can find, like this for example:
https://www.tecmint.com/sync-files-using-rsync-with-non-standard-ssh-port/
Indicate I should use -p, but that wouldn't work since I need port 22 all the way through the tunnel until the end.
How can I rsync to/from this destination server on port 12345, via a tunnel through the bastion server on the standard port 22?
Source Host (22) -> Bastion Host (22) -> Destination Host (12345)
-p 12345should apply only to the final destination as long as it's outside the quotedProxyCommandparameter. If it's put inside that quoted parameter, it should apply only to the connection to the bastion host. - Gordon Davissonssh -p 12345 -v -o ProxyCommand="ssh -W %h:%p admin@bastion-host" user@destination-host, I could see it trying to connect to my bastion host on port 12345 - Blender Fox