3 ms·
Awesome. Here is another version to support chaining multiple gateways: Host *%* Proxycommand ssh $(echo %h | rev | cut -d%% -f2- | rev) nc $(echo %h | r
by a3_nm 15y ago
Awesome. Here is another version to support chaining multiple gateways:
Host *%*
Proxycommand ssh $(echo %h | rev | cut -d%% -f2- | rev) nc $(echo %h | rev | cut -d%% -f1 | rev) %p
usage:
ssh gateway1%gateway2%target
(Not very clean, improvements welcome.)
- vidarh 15y agoThat syntax gave me flashbacks to good old bang paths...
- deleted 15y ago[deleted]
- a3_nm 15y agoA shorter version of the same thing: Host *%* Proxycommand bash -c "h=%h; ssh \${h%%\\%%*} nc \${h##*%%} %p" It would be shorter and cleaner if I knew a way to apply string operators on a constant string rather than defining the intermediate variable $h.
- haridsv 15y agoVery cool! Is there any security risk in running nc on the gateway this way?