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.


2 Answers 2


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


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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