Quantcast
Channel: User Karthik T - Stack Overflow
Viewing all articles
Browse latest Browse all 42

SSH config file setup with wildcards and DRY

$
0
0

My requirements are as follows

  1. All of our cloud machines need the same config (User, Port, IdentityFile)
  2. I need these settings to be applied to them based on domain (*.xyz.com)
  3. I also need these settings to be applied when i setup short hosts (See below)

My current SSH config is a

Host shortname1?    Hostname %h.prod.xyz.comHost test-myname    Hostname combo.test-myname.xyz.comHost *.xyz.com    Hostname %hHostname *.xyz.com    User myuser    Port 12345    IdentityFile ~/.ssh/id_rsa

The exact use cases are ssh shortname1a; ssh shortname1b; ssh test-myname; ssh combo.test-myname.xyz.com

Host *.xyz.com was a recent addition after debugging for the last use case, and this somehow seems to break the first 2.

Is this the right way or is there a neater way?


Viewing all articles
Browse latest Browse all 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>