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?
How to get the public key from sshd server without touching the known_hosts file?
sshd
Try ssh-keyscan domain-name and it'll output the public key for you.