I'd like to know whether there is a way to assign a default ssh gateway to a hostname such that, whenever you attempt to ssh to the hostname it uses the gateway to reach the host. Ideally this should be done in the ssh_config
e.g.: client C attempts to reach target T by
ssh T The only way this connection can be established is through gateway GW
ssh -tA GW ssh T EDIT: I neglected to mention that one may have various gateways which will reach different hosts
EDIT: I tried using the ssh config:
Host my-target-host ProxyCommand ssh -tA GW ssh %h But then I get "Pseudo-terminal will not be allocated because stdin is not a terminal"
EDIT: Okay so I figured it out :-) The correct config looks like this:
Host my-target-host ProxyCommand ssh my-gateway-host exec nc %h %p Not entirely sure why this works though...