Last active
August 17, 2021 09:01
-
-
Save jalex19100/7255957 to your computer and use it in GitHub Desktop.
User-Data script for AWS, to change the default SSHD port from 22 to 2222, or 443, the same port HTTPS uses.
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 -ex | |
perl -pi -e 's/^#?Port 22$/Port 2222/' /etc/ssh/sshd_config | |
service sshd restart || service ssh restart |
Don't know if you still need this today. AWS offers port forwarding and some other stuff, with EC2 instances, for free now. I haven't used this method of locking down SSH in a very long time.
Not sure how much that relates to my situation here, but I wanted to change the SSH port which I initially use to connect to the EC2 instance.
Otherwise when I see the sshd logs, I see many people/bots lurking in. Just too many attempts to get in.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Connection times out.