ssh keys deleted after Cloud-init key-generation

General support questions
Post Reply
musclerush
Posts: 1
Joined: 2022/05/21 16:02:32

ssh keys deleted after Cloud-init key-generation

Post by musclerush » 2022/05/21 16:05:59

i only see this happening on CentOs 7 where after cloud-init gets initialized after a reboot and executed the ssh keys are gone and you cant ssh to the machine until you restart the sshd service.

anyone know what is going one here.. it works fine with CentOs 8 , ubuntu 16, 18 and 20.

Thank you
M

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: ssh keys deleted after Cloud-init key-generation

Post by jlehtone » 2022/05/22 09:45:22

Is the cloud-init config identical on those distros?

The only place where I have had cloud-init is OpenStack-based system, the service provider's CentOS 7 image has cloud-init and it does not do deletion of keys (more likely setting of keys to empty list). It does add a key supplied by me to both root and regular account, but modifies the root's key to prevent root login. I have been able to add customizations to cloud-init config to change behaviour, both after installation and by supplying cloud-init customization script for the VM creation.

Post Reply