When you purchase a new VPS or VDS, your server comes with default settings and becomes a target for bots as soon as it connects to the internet. To turn your server into a "fortress" and keep your projects secure, here are 5 critical security steps you should apply within the first 10 minutes.
First of all, you should upgrade all packages to the latest version to patch known vulnerabilities.
Managing your server with the root user all the time is risky. It is much safer to create a new user and grant it privileges.
From now on, perform operations with this user and only use the sudo command when necessary.
Passwords can be guessed or cracked via brute-force attacks. Disabling password login and allowing only SSH key authentication is the most secure method.
Only allow the ports you need and block everything else to reduce your attack surface.
Fail2Ban automatically monitors logs and blocks IP addresses that repeatedly attempt incorrect logins.
Even with default settings, Fail2Ban immediately starts protecting SSH logins.