ssh proxy

Using SSH Proxy in .ssh/config


[ Your Machine ] ---> [ Gateway Server ] ---> [ Final Destination ]
      ssh            ProxyCommand/Jump           ssh session

The SSH ProxyCommand and ProxyJump options allow you to route SSH connections through an intermediate server (proxy), — allows SSH to reach otherwise inaccessible targets by hopping through a proxy simplifying firewall rules and enhancing security.

Configuring an SSH Proxy in ~/.ssh/config

To automate proxy connections, add the following to ~/.ssh/config:

Host final-server                                   
    ProxyCommand ssh -W %h:%p user@gateway-server

Alternative: Using ProxyJump (Simpler)

Host final-server                                   
    ProxyJump user@gateway-server