Skip to content

Instantly share code, notes, and snippets.

@musichen
Created April 30, 2025 10:46
Show Gist options
  • Select an option

  • Save musichen/4be5847df8e297bdec6468d2bf0a738e to your computer and use it in GitHub Desktop.

Select an option

Save musichen/4be5847df8e297bdec6468d2bf0a738e to your computer and use it in GitHub Desktop.
wbx-cloud-init.yml
#cloud-config
# Updated configuration for Ubuntu 24.04
users:
- name: wbx
ssh_authorized_keys:
- "ssh-ed25577 <SSHKEYHASH_HERE> wbx@wbx"
sudo: ALL=(ALL:ALL) ALL
groups: sudo
shell: /bin/bash
chpasswd:
expire: true
users:
- name: wbx
password: changeme
type: text
ssh_pwauth: false
write_files:
- path: /etc/needrestart/conf.d/99disable-prompt.conf
content: |
$nrconf{kernelhints} = -1;
package_update: true
package_upgrade: true
package_reboot_if_required: true
runcmd:
# Configure SSH securely
- sed -i '/PermitRootLogin/d' /etc/ssh/sshd_config
- echo "PermitRootLogin prohibit-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 ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment