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.

1 Answer 1

  • 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

  • 3
    for posterity- pay attention to the permissions. All the /etc/ssh/* files should be owned by root:root, with 644 permissions except for those that end in *key, which should be 600.
    – tedder42
    Apr 3, 2015 at 18:21
  • Afterwards, you probably need a sudo service ssh restart
    – nealmcb
    Jul 26, 2021 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.