0

Im trying to tunnel to DestinationHost through HopHost with

ssh -o ProxyCommand='ssh HopHostUser@HopHost nc -w 10 %h %p' DestinationHost

First, I get to authenticate towards HopHost as HopHostUser

HopHostUser@HopHost password: 

After I authenticate towards HopHost, I get

Permission denied (publickey).

HopHostUser's connection to DestinationHost is authenticated with a key, which are on configed for HopHostUser on HopHost

If I were to connect towards DestinationHost through HopHost step by step, (without it being a tunnel / proxy) All i would have to is this:

 me@localhost >> ssh HopHostUser@HopHost
 HopHostUser@HopHost password:
 HopHostUser@HopHost >> ssh DestinationHost
 HopHostUser@DestionationHost >> 

If i use -v to the original ssh command, I can see that the key on my localhost, instead of on HopHost

Can i tell SSH to use the external Key, instead of looking on my localhost?

0

You cannot use proxying/tunneling as the ssh-key is stored on the hop server and isn't accessible locally. Ideally you generate a new key and add it to ~/.ssh/authorized_keys on DestinationHost, but this may not be possible.

The easiest way to set this up is using the remote command and two local port forwards.

Open terminal on DestinationHost:

ssh -t HopHostUser@HopHost "ssh DestinationHost"

Open terminal + port forwarding from DestinationHost to Localhost:

ssh -t -L8081:localhost:9999 HopHostUser@HopHost "ssh -L9999:localhost:80 DestinationHost"

You best make use of you ssh config for this. It's very long winded.

  • 1
    Its correct that i cannot do this without a new key, And i cannot add a new key. A port forwading option would work, but i need to use scp. I solved it by it by using non orthodox methods (copy key) – Marcus Brunsten Oct 14 '15 at 13:02
0

Have you tried ?

ssh HopHostUser@HopHost ssh DestinationHost

I used to do this a few years ago, maybe ssh prevents this now. I haven't access to several hosts so I'm unable to test this command.

  • This works, but it doesnt make it a tunnel as for as I can tell. – Marcus Brunsten Oct 14 '15 at 13:00

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.