6

I am using the new ProxyJump option with SSH. I am having troubles with the IdentityFile for the proxy.

Sample SSH config:

Host proxy
     HostName 1.0.0.1
     User foo
     Port 1234
     Identityfile ~/.ssh/mykey.id_rsa

Host target
     HostName 1.0.1.1
     User bar
     Port 5678
     Identityfile ~/.ssh/mykey.id_rsa
     ProxyJump proxy
     ForwardAgent yes

Schematic:

            ssh          ssh
localhost ------> proxy ------> target
             ^             ^
           using         using
           mykey         mykey

Using the ssh command with this config works out:

ssh target

I am trying to perform this operation without the config file, but it does not work:

ssh -i ~/.ssh/mykey.id_rsa -AJ foo@1.0.0.1:1234 bar@1.0.1.1:5678

I can't find a way to specify the IdentityFile with -i for both the ProxyJump host and the target host to make it work.

This works:

ssh -i ~/.ssh/mykey.id_rsa -AJ proxy bar@1.0.1.1:5678

Is there a way of using the -i,-A,-J or -o flags to do this?

5

You can't do that with the new jump magic as far as I know. But it should work with the "old" proxy-command:

ssh -i ~/.ssh/mykey.id_rsa -Ao ProxyCommand="ssh -i ~/.ssh/mykey.id_rsa -W %h:%p -p 1234 foo@1.0.0.1" -p 5678 bar@1.0.1.1
  • getting error: 'SSH-2.0-OpenSSH_7.6\r': command not found' – dhroove Jul 30 '18 at 15:52
  • @dhroove doing something wrong. – Jakuje Jul 30 '18 at 16:12
  • ssh -ti privatekey.pem -Ao ProxyCommand="ssh -i privatekey.pem user@hostname" user@hostname -> where privatekey.pem is the key file – dhroove Jul 30 '18 at 17:33
  • added all details: superuser.com/questions/1344557/… – dhroove Jul 30 '18 at 17:51

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.