Last active
April 24, 2024 21:00
-
-
Save tomfanning/1eb299915ca061e9a937ae3efc77c1c2 to your computer and use it in GitHub Desktop.
AWS EC2 userdata script to set root pw, allow pw logon, auto updates, and set selinux permissive.
This file contains 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
#!/bin/bash -e | |
rootpw="mypassword" | |
cat /etc/ssh/sshd_config | sed "s/PasswordAuthentication no/PasswordAuthentication yes/" | sed "s/#PermitRootLogin yes/PermitRootLogin yes/" > /etc/ssh/sshd_config | |
echo " | |
MaxAuthTries 10" >> /etc/ssh/sshd_config | |
systemctl restart sshd | |
echo root:$rootpw | chpasswd | |
yum install yum-cron nano -y | |
cat /etc/yum/yum-cron.conf | sed "s/apply_updates = no/apply_updates = yes/" > /etc/yum/yum-cron.conf | |
systemctl restart yum-cron | |
echo "SELINUX=permissive | |
SELINUXTYPE=targeted" > /etc/selinux/config | |
setenforce permissive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment