I want to connect remote server using SSH. This remote server is only accesable vis bastion server. so we usually do this.
❯ ssh -A user@[**bastion server public IP**] -i ~/.ssh/server-access-private-key
then we get to bastion server, we need to one more ssh connection to remote server. This remote server doesn't have public IP. It has only private IP.
$ ssh bastion-host@172.31.67.183 -i ~/.ssh/server-access-private-key
Then we are finally got in to remote server.
How can I manage this process using one SHH command?
I tried
❯ ssh -A -J user@[**bastion server public IP**] -i ~/.ssh/server-access-private-key bastion-host@172.31.67.183 -i ~/.ssh/server-access-private-key
But I got this error.
user@[**bastion server public IP**]: Permission denied (publickey).
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
Why my SSH connection is not allowed? Although, when I try it on Bastions server, it worked. Why they complain about port 65535? since ssh port is 22.