Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 7 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

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.