Thursday, December 20, 2012

ssh-keygen to generate 2048 bits host key

There are many posts available on  the internet regarding the importance of HostKey.(check HostKey parameter in sshd_config file) Just to brief you about it, it is to provide more security while connecting to the server using ssh. When you connect to the server you will be prompted to verify the fingerprint of the key on the server. Compare the fingerprint with the one which is on the server and then go ahead with the connecting to the server

You can check the fingerprint on the server

ssh-keygen -lf /etc/ssh/ssh_host_rsa_key


By default while installing the ssh package, it generates 1024 bits length of rsa and dsa keys.

To generate these keys of different length. e.g 2048


#ssh-keygen -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key


#ssh-keygen -t dsa -b 2048 -f /etc/ssh/ssh_host_dsa_key