In order to connect to an SSH server, it must be listed in known_hosts.

Is there some command that I can run on the server which will generate the text that needs to be put into this file?

(Surely the server knows what its own key is. Getting that information directly out of the server itself seems like it ought to be the most secure method. So I'm a little surprised that there doesn't seem to be a way to do that...)

  • SSHFP DNS records are the best for this. – Jakuje May 12 '16 at 15:34

man ssh-keyscan

It scans local or remote IP addresses to return the public key.

For example, ssh-keyscan

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.