Re:SSH hacks – a little sanity for remote workers
by itsjloh on Thursday April 30, 2020 @01:18AM
(#23027662)
Jump hosts are fantastic! With a little bit of sed magic you can also setup wildcard jump hosts, eg:
I wrote about it ages ago here https://jloh.co/posts/dynamic-ssh-jump-hosts/
[ Parent
| on HN ]
Re:SSH hacks – a little sanity for remote workers
by davb on Thursday April 30, 2020 @06:59AM
(#23029544)
That's really smart!
I'd maybe even reverse it, having:
Host my-jump-host
Hostname my-jump-host.mydomain.example
User myuser
Host my-jump-host-*
User myuser
ProxyCommand ssh my-jump-host nc $(echo %h | sed 's/^my-jump-host-//') %p
This way, autocomplete in bash would work. Typing "ssh m<tab>", assuming m* doesn't match anything else, would suggest "ssh my-jump-host" (which I often ssh directly to anyway). Then just add "-myotherhost" so the whole sequence becomes "ssh m<tab><bs>-myotherhost". Not a huge saving but I'm lazy and like autocomplete in the shell.
Re:SSH hacks – a little sanity for remote workers
by Piskvorrr on Thursday April 30, 2020 @05:23AM
(#23028995)
Whoa! Now that's mighty useful, thanks! (Note that this works even without the ProxyJump option, but requires a sane netcat on the jumphost; older busyboxes only had a netcat)
Re:SSH hacks – a little sanity for remote workers
by davidcollantes on Friday May 01, 2020 @11:32AM
(#23043033)
Let's say all machines are named in the form "vm12345," but the jump server itself is also named in the same form. How would you go to include all vm in a wildcard, but the jump server itself?