I'd like to implement a (temporary, won't be a stable configuration) SSH tunnel, so I can SSH to box C from box A going through B.
A--->B--->C
I learnt that it can be done by running 2 commands on A:
ssh userB@B -L PORT:A:22
ssh userC@localhost -p PORT
The problem is that this works as long as authentication can be performed from box A, for example box C asks for userC's password, the password is prompted on box A and typed. In my case, however, the way to access box C is a key that's stored on box B (so, from box B, one just types ssh userC@C
and is not prompted for a password). Box A just sees the message Permission denied (publickey)
.
Is there a way to allow access in this case?
userC@A
. If there is no typo (did you mean-L PORT:C:22
?) and A getsPermission denied (publickey)
then this only means A's key is not enough to log in asuserC
at A. C is not involved.