Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Do I need to have a private key on the interim server pc2?

I want to connect to pc3 through pc2 without any possibility for pc2 to intercept or forge traffic from pc1 to pc3. I am on pc1.

There is following configuation on pc1.

Host pc2
     HostName pc2
     User user2
     ProxyCommand ssh -W %h:%p user@pc3

How can I setup what public/private key pair will be used for pc3 when connecting to it through pc2?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Just set this in your ~/.ssh/config

Host *
  ForwardAgent yes

Most servers have AllowAgentForwarding on by default so it will automatically forward keys when possible.

share|improve this answer
add comment

The ssh -i option specifies the location of the identity file you want to use. The -A option forwards credentials, so loading the key you want into ssh-agent via ssh-add may also do what you want without having to explicity list a key in the config file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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