Direct multi-hop ssh connection

How to use multi-hop ssh connection without needs to ssh multiple times?

asked Apr 24, 2014 by Eric Z Ma (44,280 points)
edited May 21, 2014 by Eric Z Ma

1 Answer

Best answer

As a example, you are connecting to through from as follows:

laptop ----> proxy ----> server

2 possible methods:

Method 1: Use the similar method as in Directly SSH to hosts using internal IPs through the gateway. Add this to your ~/.ssh/config on laptop:

  ProxyCommand ssh -q nc %h %p

Method 2:


ssh ssh

That is, you first log on and then ssh from there to

For both methods, Automatic Password-less SSH Login is your good friend.

answered Apr 24, 2014 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost