how to backup/restore the host key in ssh server

I have a ssh server, and some clients have login it via key login. So the host identity of server has been stored in the known_host of clients.

I want to reinstall the server, but I hope it never impact the experience of client. I'm wondering whether it's possible to backup the host identity of server, then restore it.


  • You can backup those keys from /etc/ssh/ssh_host*
  • You can also backup all in /etc/ssh directory so that you keep all config and keys.
  • And to restore put your keys back in the same location /etc/ssh

alt text