Ssh connect through another host

Revision as of 09:29, 22 May 2023 by Heiko (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The issue

I wanted to connect to a host through another host. And I wanted it as simple as possible to use.

The solution

Make sure sshd and netcat (nc) is installed and set up on your server(s). (sshd on both, nc only on the "proxy")

Then add this to your .ssh/config:

    Hostname [TARGETHOST]
    ProxyCommand ssh [PROXY-HOST-CAN-ALSO-BE-CONFIGURED-IN-.ssh/config] exec nc %h %p