I have to set up an ssh/sftp connection which needs a certain configuration, and I've been looking around but didn't find an answer. I'm not sure it's even possible without some work around.

I have 4 IPs (like the below example):

  1. - User PC

  2. - SSH gateway

  3. - Proxy server

  4. - SSH server on the internet

What I need is to SSH from 1 to 4, using the ssh gateway, which requires the proxy (3) to access the internet. Currently i'm able to connect from 1 to 4 if i set up the proxy on 1 without passing by 2, but this is not acceptable. And I'm able to connect from 2 to 4 using the proxy. But if I try to connect from 1 to 4, using the gateway, I'm not sure how to tell the gateway to use the proxy. The tools I can use are netcat and connect-proxy on machine 1 and 2, but ProxyJump is not installed.

Any suggestions?


For anybody who is looking for an answer to the same question, i found a way to make this work:

Host gateway
User gatewayuser

Host sshserver
User sshuser
ProxyCommand ssh gateway connect-proxy -H %h %p

Then from the client machine

$ ssh sshserver

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.