canonical / canonical/cloud-init

cloud-init not import public key to authorized_keys in ubuntu24.04

Open
#6,175 11 comments 1 reaction 0 assignees View on GitHub
bug incomplete
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# Bug report
I download this ubuntu24.04.2 LTS server ISO image from https://ubuntu.com/download/server , and upload to my openstack platform to create a image , then create VM from the image , but I cannot login this VM with ssh key , as checked , the /home/ubuntu/.ssh/authorized_keys is empty , in the cloud-init.log I can find below logs

2025-04-15 07:31:29,361 - util.py[DEBUG]: Reading from /etc/ssh/sshd_config (quiet=False)
2025-04-15 07:31:29,361 - util.py[DEBUG]: Reading 3255 bytes from /etc/ssh/sshd_config
2025-04-15 07:31:29,362 - util.py[DEBUG]: Changing the ownership of /home/ubuntu/.ssh to 1000:1000
2025-04-15 07:31:29,362 - util.py[DEBUG]: Writing to /home/ubuntu/.ssh/authorized_keys - wb: [600] 0 bytes
2025-04-15 07:31:29,362 - util.py[DEBUG]: Changing the ownership of /home/ubuntu/.ssh/authorized_keys to 1000:1000
2025-04-15 07:31:29,362 - util.py[DEBUG]: Reading from /home/ubuntu/.ssh/authorized_keys (quiet=False)
2025-04-15 07:31:29,362 - util.py[DEBUG]: Reading 0 bytes from /home/ubuntu/.ssh/authorized_keys
2025-04-15 07:31:29,363 - handlers.py[DEBUG]: finish: modules-final/config-ssh_authkey_fingerprints: SUCCESS: config-ssh_authkey_fingerprints ran successfully and took 0.002 seconds

it indicates cloud-init wrote 0 bytes to the /home/ubuntu/.ssh/authorized_keys file

## Steps to reproduce the problem

## Environment details
- Cloud-init version: 24.4-0ubuntu1~24.04.2
- Operating System Distribution: ubuntu24.04.2-lts server
- Cloud provider, platform or installer type: openstack

## cloud-init logs

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.