Host authenticity check
Posted Feb 16, 2007 23:55 UTC (Fri) by
ldo (subscriber, #40946)
Parent article:
Set up remote access in UNIX through OpenSSH (developerWorks)
The article mentions the "authenticity of host <blah> can't be established" warning, but implies that you simply have to put up with it the first time you connect to a new host.
In fact, ignoring this warning and typing "yes" to proceed leaves you open to the chance of a host-spoofing attack. The right way to deal with this is one of:
You (or somebody) previously did the following command on that host:
ssh-keygen -l -f /etc/ssh/ssh_host_key.pub
and saved the output so you can compare the host key fingerprint with that from the warning, to ensure they're the same. Or,
You previously grabbed a copy of the entire /etc/ssh/ssh_host_key.pub file, so you can manually insert it into your ~/.ssh/known_hosts file and avoid the warning altogether.
The article says you will get another "warning" if the host key changes. In fact, in the default SSH configuration, this is not a warning, this is an error, and it will not let you connect to the host. This is a Good Thing, as there should never be any reason for the host key to change. (When I install a new Linux version on a machine, one of the things I'm careful to save from the old configuration is the SSH host key.)
(
Log in to post comments)