![]() |
The Problem: Default Exposure
A freshly installed Linux server exposed to the public cloud is a blank canvas, but also an easy target. Default SSH daemon configurations and open ports immediately attract automated scanners, botnets, and brute-force attacks.
The Solution: 5 Steps to Hardening
Before installing any enterprise application, the infrastructure must be locked down by enforcing the principle of least privilege.
- 1. Public Key Authentication: Ditch passwords entirely. Generate a certificate using
ssh-keygen, copy it to the server, and edit/etc/ssh/sshd_configby settingPasswordAuthentication no. - 2. Disable Root Login: In the same SSH configuration file, ensure you set
PermitRootLogin noto force access only via standard users and subsequent privilege elevation viasudo. - 3. Firewall Segmentation (UFW): Drop all incoming traffic except what is strictly necessary.
sudo ufw default deny incoming sudo ufw allow ssh sudo ufw enable - 4. Brute-Force Mitigation (Fail2Ban): Automatically ban malicious IPs at the network level that repeatedly fail login attempts.
sudo apt install fail2ban -y - 5. Silent Updates: Keep the system protected from zero-day vulnerabilities by installing
unattended-upgradesfor the automatic application of critical security patches without service interruptions.



