Last active
August 28, 2023 12:10
-
-
Save ismailkarsli/234020c31adc69291f157e356a5eb6a0 to your computer and use it in GitHub Desktop.
cloud-init.yaml
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: ismail | |
groups: users, admin | |
sudo: ALL=(ALL) NOPASSWD:ALL | |
shell: /bin/bash | |
ssh_authorized_keys: | |
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPdJr63tCOvAaA42XTABCY1BL6jRNwq7qNF5uoNNsqoY [email protected] | |
package_update: true | |
package_upgrade: true | |
runcmd: | |
- sed -i -e '/^\(#\|\)PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config | |
- sed -i -e '/^\(#\|\)PasswordAuthentication/s/^.*$/PasswordAuthentication no/' /etc/ssh/sshd_config | |
- sed -i -e '/^\(#\|\)MaxAuthTries/s/^.*$/MaxAuthTries 3/' /etc/ssh/sshd_config | |
- sed -i -e '/^\(#\|\)AuthorizedKeysFile/s/^.*$/AuthorizedKeysFile .ssh\/authorized_keys/' /etc/ssh/sshd_config | |
- sed -i '$a AllowUsers ismail' /etc/ssh/sshd_config | |
- reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment