I have set up ssh key pairs between my desktop and two servers, and from the servers to my desktop, but after reinstalling the OS on my desktop, I can\'t re-establish the key-pa
This issue arises when the host key is expired or changed. you can remove the keys that host is using and try to ssh again, so that you are adding new key that is known to both client and server.
You can check the keys associated with your hosts with cat /.ssh/known_hosts
. Now, You can remove the hosts keys manually or using the ssh-keygen option. You can do either of the following option.
Manual removal of keys
vim /.ssh/known_hosts
delete the key that is associated with your host.
Remove key using ssh-keygen
ssh-keygen -R your_host_or_host_ip
This will remove your key associated with the host.
Now, you can ssh to your host as usual and you will be asked if you want to continue to this host. Once your enter yes, this host will be added to your/.ssh/known_hosts with updated key. By now, you should be your host.