Is it possible to edit substitutions within ssh_config? I know I can match wildcards such as:
Host project*
HostName %h.domain.com
User project_user
Used thus:
ssh project000
rsync data project123:~
But are more complex rules possible? How about match to a hostname alias (without explicitly generating every possible combination)?
p -> project000.domain.com
p1 -> project001.domain.com
p123 -> project123.domain.com
Just in case: I use both bash and zsh
This is how I'm managing this:
My ~/.ssh/config
:
Host project*
ProxyCommand ~/bin/ssh_proxy %h
And ~/bin/ssh_proxy
:
#!/bin/zsh
function make_host {
HOST_NUM=${1[8,999]}
echo project${(l(3)(0))HOST_NUM}
}
exec nc `make_host $1` 22
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With