Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 8 down vote accepted
  • 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

share|improve this answer
thanks. it works well. – Kane Dec 13 '10 at 3:34
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 '15 at 18:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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