/cj-cloud-init.yml Secret
Last active
June 10, 2025 01:57
-
Star
(115)
You must be signed in to star a gist -
Fork
(102)
You must be signed in to fork a gist
-
-
Save w3cj/cdd447b1a10ce741e4ee968fa6b75553 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This config was written for Ubuntu 22.04 | |
# If you are using a more recent version, see the comments of this gist for fixes | |
#cloud-config | |
users: | |
- name: cj | |
ssh_authorized_keys: | |
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBlfqermlV44zAU+iTCa5im5O0QWXid6sHqh2Z4L1Cm [email protected]" | |
sudo: ALL=(ALL:ALL) ALL | |
groups: sudo | |
shell: /bin/bash | |
chpasswd: | |
expire: true | |
users: | |
- name: cj | |
password: changeme | |
type: text | |
runcmd: | |
- sed -i '/PermitRootLogin/d' /etc/ssh/sshd_config | |
- echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config | |
- sed -i '/PubkeyAuthentication/d' /etc/ssh/sshd_config | |
- echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config | |
- sed -i '/PasswordAuthentication/d' /etc/ssh/sshd_config | |
- echo "PasswordAuthentication no" >> /etc/ssh/sshd_config | |
- systemctl restart sshd | |
- echo "\$nrconf{kernelhints} = -1;" > /etc/needrestart/conf.d/99disable-prompt.conf | |
- apt update | |
- apt upgrade -y --allow-downgrades --allow-remove-essential --allow-change-held-packages | |
- reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have also encountered issues with running cloud init on Hetzner Ubuntu 24.04 ARM VPS. Unfortunately,
sshd
was not aliased so I had to usesystemclt restart ssh
instead.Here is a config that ended up working for me