Skip to content

Instantly share code, notes, and snippets.

@IsaiahByDayah
Forked from w3cj/cj-cloud-init.yml
Last active November 16, 2025 01:05
Show Gist options
  • Select an option

  • Save IsaiahByDayah/f42b8e8b9b1306e97e50f3ee4726f2b6 to your computer and use it in GitHub Desktop.

Select an option

Save IsaiahByDayah/f42b8e8b9b1306e97e50f3ee4726f2b6 to your computer and use it in GitHub Desktop.
#cloud-config
users:
- name: isaiah
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIFVM/7RnSK0BE4bK7/2KBP++phbD+CCqFdtb9kpkIPi isaiah-macbook-pro-14inch-m1-pro"
sudo: ALL=(ALL:ALL) ALL
groups: sudo
shell: /bin/bash
chpasswd:
expire: true
users:
- name: isaiah
password: changeme
type: text
package_update: true
package_upgrade: true
runcmd:
- sed -i -e '/^\(#\|\)PermitRootLogin/s/^.*$/PermitRootLogin without-password/' /etc/ssh/sshd_config
- sed -i -e '/^\(#\|\)PubkeyAuthentication/s/^.*$/PubkeyAuthentication yes/' /etc/ssh/sshd_config
- sed -i -e '/^\(#\|\)PasswordAuthentication/s/^.*$/PasswordAuthentication no/' /etc/ssh/sshd_config
- systemctl restart ssh
- echo "\$nrconf{kernelhints} = -1;" > /etc/needrestart/conf.d/99disable-prompt.conf
power_state:
delay: 1
timeout: 60
mode: reboot
message: Rebooting after cloud init
@IsaiahByDayah
Copy link
Author

Note

AFAIK this public ssh key is explicitly for my MacBook Pro 14in M1 Pro. Any other/additional computers would need their own ssh key added to access.

@IsaiahByDayah
Copy link
Author

Note

The first line #cloud-config is important and required in order for things to be parsed correctly!

@IsaiahByDayah
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment