[CentOS] server host keys for kvm clones

Wed Jan 4 21:31:10 UTC 2012
Mikael Fridh <frimik at gmail.com>

On Wed, Jan 4, 2012 at 8:08 PM, James B. Byrne <byrnejb at harte-lyne.ca> wrote:
> Respecting cloning vm guests, I see in /etc/ssh the
> following:
>
> ssh_host_dsa_key
> ssh_host_dsa_key.pub
> ssh_host_key
> ssh_host_key.pub
> ssh_host_rsa_key
> ssh_host_rsa_key.pub
>
> Is there a simple script somewhere to regenerate all the
> server host keys for the new guest after cloning?

Simple, just remove them and boot the server or restart sshd:

# rm -f /etc/ssh/ssh_host*key*; /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Generating SSH1 RSA host key:                              [  OK  ]
Generating SSH2 RSA host key:                              [  OK  ]
Generating SSH2 DSA host key:                              [  OK  ]
Starting sshd:                                             [  OK  ]

--
Mikael Fridh