Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

When I connect to the company OpenVPN they don't push their DNS to my computer, which means I have to type the FQDN for the hosts I e.g. SSH and HTTP to.


Is it possible to configure my Linux desktop, so can do

ssh ss@serv

instead of

ssh ss@serv.example.com


There is only one domain, so incase the non-FQDN fails, it will always work, if just example.com is appended.

share|improve this question

migrated from serverfault.com Jun 18 '13 at 13:58

This question came from our site for system and network administrators.

linux.die.net/man/5/resolv.conf – Iain Jun 18 '13 at 10:25
up vote 6 down vote accepted

Add this line to your resolv.conf:

search example.com

See resolv.conf(5) for details. If there is already a search line, just append example.com to its end

share|improve this answer

Another approach (~/.ssh/config):

Host *.example.com
 HostName %h
 USER user

Host *
 HostName %h.example.com
 USER user

This allows both forms:

ssh private.example.com # ssh user@private.example.com
ssh private             # ssh uesr@private.example.com

This really only works in the case where you are only connecting to .example.com hostnames (since * will match everything). I use a variation where I want to match only hostnames starting with dev-:

Host dev-*.example.com
 HostName %h
 USER user

Host dev-*
 HostName %h.example.com
 USER user
share|improve this answer

Your Answer


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.