Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 6 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.