ssh-keyscan -H <ip address> | cut -d" " -f1 >> ~/.ssh/known_hosts ssh-keyscan -H <domain name> | cut -d" " -f1 >> ~/.ssh/known_hosts now edit ~/.ssh/known_hosts and paste the public key for the server in after those hashed hostnames (presumably you got the key onto this machine with a USB stick or other secure means).