A follow-up to my earlier post about securing access to your RPi. (fail2ban-lifesaver). Some amount of security can indeed be obtained through obscurity. One way to do this is to change the default port # for the ssh server. Since most hackers will try to attack port 22 first, it’ll take some time to reach the obscure port number set by you on your RPi. Yes port scanning will eventually find it, but hey, why not delay the attack 🙂
#Port 22 Port 16022
Read up about how to change the default ssh server port here (its really quite simple): Change default ssh port.
Also remember to change it in the fail2ban config file.
#port = ssh port = 16022
Further security measures like public key, port knocking: Harden the ssh server.
I also used iptables to block a whole range of IP addresses, from which hackers are trying to attack my RPi. This is how you do it: Block a range of IP addresses.
sudo iptables -I INPUT -s 18.104.22.168/8 -j DROP