Friday, July 8, 2011

Adding SSH host key to known_hosts

$ sudo sh -c "ssh-keyscan -H -t rsa,dsa hostname >> /etc/ssh/ssh_known_hosts"


-H Hash all hostnames and addresses in the output.  Hashed names may be used normally by ssh and sshd, but they do not reveal identifying information should the file's contents be disclosed.

-t type Specifies the type of the key to fetch from the scanned hosts.  The possible values are “rsa1” for protocol version 1 and “dsa”, “ecdsa” or “rsa” for protocol version 2.  Multiple values may be specified by separating them with commas.  The default is “rsa”.