Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 7 down vote accepted

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.

share|improve this answer
    
Can you have multiple searches in a resolv.conf? I'm on an AD domain that is set as my search currently. – Joshua Olson Dec 15 '11 at 0:00
    
Yes you can, this is the purpose of search domains, and many sites run multiple concurrent domains that need to be checked to find the right host – Paul Dec 15 '11 at 0:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .