I have 2 linux hosts behind a router. The router forwards port 22 to host A's port 22. The router forwards port 20020 to host B's port 22. The router has a public address at myhost.com
This works fine for ssh and scp. I can do 'ssh myhost.com' and log into host A, and I can do 'ssh -p 20020 myhost.com' and log into host B.
However, when I try:
rsync --port=20020 myhost.com:/remotefolder/ /localfolder
it is actually trying to connect to host A, not host B. I can see this in host A's /var/log/messages:
Invalid user joe from 18.104.22.168
No attempted login appears in B's /var/log/messages.
I've also tried:
rsync rsync://myhost.com:20020/remotefolder/ /localfolder
and get the error, "rsync: server sent "SSH-2.0-OpenSSH_5.8" rather than greeting"
So, what am I doing wrong?