Monday, 22 July 2019

In your ssh config is it possible to have one host entry for multiple machines on the same domain


I'd like to be able to do something like


Host *
HostName *.mydomain.com
...

So I can type something like


ssh test
ssh ci
ssh dev

Instead of having to type


ssh test.mydomain.com
ssh ci.mydomain.com
ssh dev.mydomain.com

Right now I have separate entries for each one, but we have dozens of machines, so I'd rather have a default rather than have to duplicate everything so many times.



Answer



Instead of doing this with ssh, use the /etc/resolv.conf file


Add a line saying


search mydomain.com

What this does is wherever you don't enter a full domain name, it will use this suffix to work out the full name, effectively appending .mydomain.com to ci when you do ssh ci.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...