If I do:

ssh -J jumphost.example.com target.example.com

I end up immediately logged on to 'target'.

If I use this ssh config file, using the newer ssh-7.3 jump config:

Host jump 10.1.*, targets*, *.example.com
  HostName jumphost.example.com
  IdentitiesOnly yes
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa

I end up logged into 'jumphost' not 'target'

They keychain stuff is for mac, I have tested without it and it makes no difference but thought I'd leave it in just in case.

  • 1
    -J is ProxyJump and not HostName. Feb 17, 2019 at 14:42

2 Answers 2


You end up logged in to the jump host because your configuration explicitly says to ignore the hostname you specified and log in to the jump host.

  HostName jumphost.example.com

HostName overrides the hostname specified on the command line.

If you are trying to automatically use a jump host without having to specify it on the ssh command line, the correct config file option is ProxyJump. For example:

Host everything, behind, jumphost, *.example.com
  ProxyJump jumphost.example.com

Now you can just run ssh target.example.com and you will go through the jumphost.


The problem is that the Host definition catches both jumphost.example.com AND target.example.com as aliases, it then sets HostName to jumphost.example.com in both cases.

I would suggest making the aliases following the Host command NOT fully qualified domain names, then creating a Host entry for each

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.