I have 3 computers. A, B and C.
I want to SSH from computer A to C via B.
I want to do this through key authentication method. Now, to make this work:
I create a key pair on C, send the public key on B and then use use reverse tunnel SSH on C to connect to B at port x.
ssh -i KEY1 -f -N -R B_ipaddress:PORT:localhost:22 B_username@B_ipaddress -o GatewayPorts=yes
Gets connected fine.
Then, I create a second key pair at A, send the public key on B and then use this method to connect:
SSH -i KEY2 -p PORT B_username@B_ipaddress
I get Permission denied (Public Key) error. I already added the keys in authorized_keys file. Even the permissions appear to be fine. Still no luck.
If I remove the port in SSH method when connecting from A, I am able to connect directly to B without any issues. But that doesn’t help me connect to C.
Any help would help. I just started out with the Networking systems. Sorry if this sounds amateurish. Thanks in advance.