How To: Ubuntu / Debian Linux Regenerate OpenSSH Host Keys

Originally published at:

How do I regenerate OpenSSH sshd server host keys stored in /etc/ssh/ssh_host_* files? Can I safely regenerate ssh host keys using remote ssh session as my existing ssh connections shouldn’t be interrupted on Debian or Ubuntu Linux? How do I regenerate new ssh server keys? How to regenerate new host keys on a Debian or Ubuntu Linux?

as per this article

If we copy the ssh rsa key to another machine , as mentioned in the link ssh-copy-id
where its copying any default path to the remote server .