12

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 [email protected]:1234 [email protected]: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 [email protected]:5678

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

1 Answer 1

6

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 [email protected]" -p 5678 [email protected]
5
  • getting error: 'SSH-2.0-OpenSSH_7.6\r': command not found'
    – Dhruv
    Jul 30, 2018 at 15:52
  • @dhroove doing something wrong.
    – Jakuje
    Jul 30, 2018 at 16:12
  • ssh -ti privatekey.pem -Ao ProxyCommand="ssh -i privatekey.pem user@hostname" user@hostname -> where privatekey.pem is the key file
    – Dhruv
    Jul 30, 2018 at 17:33
  • added all details: superuser.com/questions/1344557/…
    – Dhruv
    Jul 30, 2018 at 17:51
  • 1
    It's a shame, I will like to use the ssh -j command specifying an ssh key. Jun 4, 2020 at 23:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .