Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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) – LanceBaynes May 7 '12 at 1:16
up vote 9 down vote accepted

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

share|improve this answer

Your Answer


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.