Saturday, January 2, 2021

Preserving SSH keys of a host

Generally when we are connecting to a replacement host from another server, for the first time it asks for yes / no option to add the host entry in the known_host as the fingerprint changes.

To retain the same while migrating to a new server the below process can be followed.  

ls -l /etc/ssh/*key* > ~/key_list

mkdir ~/serverkeys && cp -p /etc/ssh/*key* ~/serverkeys/

cp -p ~/serverkeys/*key* /etc/ssh

ls -l /etc/ssh/*key* | diff - ~/key_list

Test ssh connection to the new host. 

No comments: