2

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.

Question

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.

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

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

7

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

3

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.