Skip to content

Instantly share code, notes, and snippets.

@Nurou
Created November 24, 2024 10:26
Show Gist options
  • Save Nurou/a24ceef214d8c0350161e0f9f84531b6 to your computer and use it in GitHub Desktop.
Save Nurou/a24ceef214d8c0350161e0f9f84531b6 to your computer and use it in GitHub Desktop.
Cloud config
#cloud-config
users:
- name: joel
ssh_authorized_keys:
- <pub_key>
sudo: ALL=(ALL:ALL) ALL
groups: sudo
shell: /bin/bash
chpasswd:
expire: true
users:
- name: joel
password: changeme
type: text
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 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