R
R
Rhaps1072016-05-22 19:27:05
SSH
Rhaps107, 2016-05-22 19:27:05

How to write .ssh/config to ssh into the second server using the key of the first one?

If done sequentially

ssh [email protected]
ssh [email protected]

then we successfully get to the second server.
If you try to write it in .ssh/config in this form
Host server1
  HostName server1
  Port 22
Host server2
  ProxyCommand ssh server1 nc %h %p
  HostName server2
  Port 22

then the command ssh -v [email protected] will display the fact that for the final server ssh is trying to transfer local ssh keys from the desktop, they are not suitable, because these keys are not needed and then you are prompted to enter a password:
[email protected]'s password:
What is the correct way to write a config in this situation?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question