I have to administer a whole pile of hosts over ssh. However I can only access them through a certain gateway ssh server.
I have the following in my ~/.ssh/config
:
Host mygateway-www
Hostname www
IdentityFile ~/.ssh/id_rsa
ProxyCommand ssh mygateway nc %h 22
However I have to connect to lots of these machines. Instead of putting dozens of entries in my ~/.ssh/config
, is there anyway I can have something like this:
Host mygateway-*
Hostname ???WHAT GOES HERE????
IdentityFile ~/.ssh/id_rsa
ProxyCommand ssh mygateway nc %h 22
I know you can use %h
in the Hostname
argument, but that would be the hostname. What I really need is some sort of string substitution, like bash's ${VAR%thingie}
. Is this possible?