Skip to content

Using User Data

Change SSH port

#!/bin/bash

echo "Port 2222" >> /etc/ssh/sshd_config
systemctl restart sshd

Change SSH port

#!/bin/bash

sed -i "s|PasswordAuthentication no|PasswordAuthentication yes|" /etc/ssh/sshd_config
echo -e 'ec2-user:1234' | chpasswd
systemctl restart sshd
#!/bin/bash

sed -i "s|PasswordAuthentication no|PasswordAuthentication yes|" /etc/ssh/sshd_config
echo -e 'ubuntu:1234' | chpasswd
systemctl restart sshd