I have a multihop SSH connection to my lab PC for when I am working away, I cannot store the SSH keys on the intermediate steps if I am to use a SSH key.

<laptop> ---> <external_server>  ---> <internal_server> ---> <lab_pc>

Is it possible to have the identity files stored on the laptop and not on the intermediate servers for logging in to the internal_server and lab PC or must they be stored on the previous hop?


example of .ssh/config :

Host externalserver.university-a.edu
    User user-external

Host internalserver.university-a.edu
    ProxyCommand ssh externalserver.university-a.edu nc -w10 internalserver.university-a.edu 22
    User user-internal

Host labpc.university-a.edu
    ProxyCommand ssh internalserver.university-a.edu nc -w10 labpc.university-a.edu 22

you can replace in some case :

ProxyCommand ssh hosta.example.com nc -w10 hostb.example.com 22


ProxyCommand ssh hosta.example.com -W hostb.example.com:22
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.