How To: Ubuntu / Debian Linux Regenerate OpenSSH Host Keys

Originally published at: https://www.cyberciti.biz/faq/howto-regenerate-openssh-host-keys/

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
https://www.cyberciti.biz/faq/linux-generating-rsa-keys/
If we copy the ssh rsa key to another machine , as mentioned in the link ssh-copy-id userName@server2.nixcraft.net.in
where its copying any default path to the remote server .