6

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?

5

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.

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.