Generate new SSH Host keys
Hi,
After the fresh installation, and patching the server for the purpose of Virtual Template. If I create a new VMs from this template, There will be same host keys for all virtual servers. Can we create new keys for the template VM, so the new VM shall have different keys and how to generate the new keys for existing VMs that have duplicate keys.? Thanks, |
Have your VM creation script call ssh-keygen towards the end. From within the VM, the directory /etc/ssh/ will be used. Pre-existing SSH host keys have to be deleted, but be careful not to delete anything else.
Code:
ssh-keygen -a 17 -A Code:
ssh-keygen -a 17 -A -f /mnt See "man ssh-keygen" about the -A option. Which distro is this for, including version? |
Thank you for helping.
I am using Oracle Linux 8.8, after running the command and matched the values/content of the files it were same, so it seems that it didn't make any changes. |
Quote:
As mentioned, you have to delete the old keys yourself. The -A option won't overwrite them. |
All times are GMT -5. The time now is 12:51 PM. |