Are there any tricks to get the public key (the line that goes into the known_hosts file after I answered yes after connecting with ssh) of a server?

  • I just want to check that behind a domain is the IP that is really behind the domain. (I can check this by comparing the public ssh key of the domain+IP - so I need to connect twice with ssh client: once using the domain as destination, and once using the IP as destination that I got from the dig command) May 7, 2012 at 1:16

1 Answer 1


Try ssh-keyscan domain-name and it'll output the public key for you.

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.