I have a remote ssh connection problem I need help with.
I have machine A which is a vps running centos 6 on the internet with public ip address.
I have two centos6 machines at home on my LAN, machine B and machine C.
Machine B ssh access is on the default port 22
Machine C ssh access is on a different port - 1234.
From machine B I can run:
# sshpass -p <password> ssh -t -t -R
8023:localhost:22 <user>@<ip-addrr-machine-A)
and then I can log in to machine B remotely from machine A using this command:
# ssh -p
8023 localhost
However if I try the same thing from machine C (ssh port 1234) machine A throws error:
Code:
ssh_exchange_identification: Connection closed by remote host
The command I run on machine C is:
# sshpass -p <password> ssh -t -t -R
8025:localhost:22 <user>@<ip-addrr-machine-A)
and on machine A I then run:
# ssh -p
8025 localhost
and that's when I get the ssh_exchange... error.
The problem is machine C is talking on ssh port 1234 and machine A is coming back on port 22. I've checked this by changing machine C temporarily back to the default port 22 and the remote connection from machine A then works fine.
So to connect to machine C how can I make machine A come back on port 1234?