Search code examples
sshopensshssh-config

How to make .ssh/config file Hostname configurable


I am trying to set up ~/.ssh/config file and want to make the hostname configurable

ssh pe1-cl1-bo1 should resolve to perf1-client1.app.bo1.host.in
ssh pe1-c2-bo3 should resolve to perf1-client2.app.bo3.host.in

i.e 
pe -> expands to perf
cl -> expands to client
bo -> remains as it s 

I just want one entry in my ~/.ssh/config file

Host $1-$2-$3
    Hostname $1.$2..$3

Can anyone suggest a way to do it?? I tried using ProxyCommand but am unable to figure out how to use it.


Solution

  • This is not possible in ssh_config. There are no mechanisms to do this substitution. But you should be able to write bash function to do that parsing for you.