← Back to team overview

cloud-init team mailing list archive

How to regenerate ssh key by cloud-init ?


   I created ubuntu 20.04 LTS image for openstack by
   There is a sysprep in the final stage which would remove MAC and
ssh_host_xxx of sshd.
    So I have to generate a new one, othewide sshd daemon fails to start.
    This is cloud.cfg created by ubuntu server autoinstall.

disable_root: true
growpart: {mode: 'off'}
locale: en_US.UTF-8
power_state: {mode: reboot}
preserve_hostname: true
resize_rootfs: false
ssh_pwauth: true
timezone: Asia/Hong_Kong
- gecos: ubuntu
  groups: [adm, cdrom, dip, plugdev, lxd, sudo]
  lock_passwd: false
  name: ubuntu
  shell: /bin/bash
How can I generate these keys? Normally it should be generate by `sudo
ssh-keygen -A' manually.

One more thing, how can I use openstack user-data ?

Follow ups