Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have my DNS search path set to ".intranet", ie, /etc/resolv.conf contains:

search intranet

When I SSH to a host using a FQDN, like "mailserver.intranet", it adds an entry for "mailserver.intranet" to ~/.ssh/known_hosts. If I later SSH to this same host but using the simple "mailserver" name, SSH adds another entry to known_hosts for "mailserver".

Is it possible to make SSH always use FQDN in known_hosts to avoid this duplicity?

share|improve this question
add comment

1 Answer

You could use aliases for host keys:

Host <hostname>*
    hostname    <fqdn>
    HostKeyAlias    <alias>

Your key will be saved to known_hosts as "alias" instead of "hostname" either short or long, the downside is you have to write an entry for each one of your hosts.

Please note the '*' after the hostname at the first line, it's needed for matching both the short and long hostname.

share|improve this answer
add comment

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.