Monday, June 20, 2011

Configure SSH jump hosts

Here is a configuration for establishing an ssh connection to a hidden host via a jump host.
This allows to connect hiddenhost just by typing (also works with scp and sftp)
    > ssh hiddenhost
if public keys for both jump.host and 10.0.0.1 are available in the local host,
then the connection will be established without prompting for any password.
Edit: .ssh/config and add the entry:


# connect: username@hiddenhost (10.0.0.1) via me@jump.host
Host hiddenhost
   User username
   HostName 10.0.0.1
   ProxyCommand ssh  me@jump.host  nc %h %p
   ForwardAgent yes

Alternatively with the following line is possible to establish the connection to 10.0.0.1, 
but the local key will not be presented to 10.0.0.1

    > ssh -t me@jump.host   ssh  username@10.0.0.1

Source: http://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts#Jump_Hosts_--_Passing_through_a_gateway_or_two

No comments:

Post a Comment