Created
November 24, 2024 10:26
-
-
Save Nurou/a24ceef214d8c0350161e0f9f84531b6 to your computer and use it in GitHub Desktop.
Cloud config
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
#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