Skip to content

Instantly share code, notes, and snippets.

@IsaiahByDayah
Forked from w3cj/cj-cloud-init.yml
Last active December 25, 2024 14:05
Show Gist options
  • Save IsaiahByDayah/f42b8e8b9b1306e97e50f3ee4726f2b6 to your computer and use it in GitHub Desktop.
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 [email protected]"
sudo: ALL=(ALL:ALL) ALL
groups: sudo
shell: /bin/bash
chpasswd:
expire: true
users:
- name: isaiah
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 ssh
- 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
@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!

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