Ssh connect through another host: Difference between revisions
Jump to navigation
Jump to search
Line 7: | Line 7: | ||
Then add this to your <tt>.ssh/config</tt>: | Then add this to your <tt>.ssh/config</tt>: | ||
Host [TARGETHOSTNAME] | Host [TARGETHOSTNAME] | ||
Hostname [TARGETHOST] | Hostname [TARGETHOST] | ||
User [USERONTARGETHOST] | User [USERONTARGETHOST] |
Revision as of 13:21, 12 December 2018
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) ist installed and set up on your server. (sshd on both, nc only on the "proxy")
Then add this to your .ssh/config:
Host [TARGETHOSTNAME] Hostname [TARGETHOST] User [USERONTARGETHOST] ProxyCommand ssh [PROXY-HOST-CAN-ALSO-BE-CONFIGURED-IN-.ssh/config] exec nc %h %p
- See also: