After handling dozens of ransomware incidents in hosting support, I've seen the same preventable mistakes over and over. A compromised WordPress plugin leads to shell access. SSH runs with password auth on port 22. Backups live on the same filesystem that gets encrypted. The pattern repeats.
This checklist catalogs the nine most common errors and pairs each with the correct hardening step. None of this is theoretical—these are the gaps attackers actually exploit and the controls that would have stopped them.
Mistake 1: Running SSH with password authentication
Password authentication on SSH is the easiest route in. Attackers run credential stuffing against port 22 using leaked password dumps, and eventually one works. I've seen servers compromised within hours of going live with a weak root password.
The fix: key-only authentication
Disable password auth entirely. Generate an ED25519 key pair on your local machine, copy the public half to the server, then lock the door:
ssh-keygen -t ed25519 -C "[email protected]"
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@your-server
On the server, edit /etc/ssh/sshd_config:
PasswordAuthentication no
ChallengeResponseAuthentication no
PubkeyAuthentication yes
PermitRootLogin prohibit-password
Restart SSH and test the key login from a second terminal before closing your current session. If you lock yourself out, most hosting panels offer an emergency console.
Mistake 2: Storing backups on the same server or mounted filesystem
Ransomware encrypts everything it can reach. If your backups sit in /var/backups or on a permanently mounted network share, they're encrypted alongside your production data. Recovery becomes impossible.
The fix: offline or immutable backup storage
Backups must live somewhere the compromised server cannot modify them. Three patterns work:
-
Push to object storage with versioning enabled. Write daily snapshots to AWS S3, Backblaze B2, or Cloudflare R2. Enable object lock or versioning so even an attacker with the API key cannot delete old versions.
-
Pull from a separate backup server. A dedicated backup host pulls data over SSH on a schedule. The production server has no credentials to reach the backup host. An attacker on the web server cannot touch the backup machine.
-
Rotate to removable media. For small setups, rsync to an external drive, then physically disconnect it.
Test restoration quarterly. A backup you've never restored is just hope.
Mistake 3: Running services as root or with excessive privileges
Web servers, databases, and application processes rarely need root. When they run as root and an attacker exploits a vulnerability, that attacker inherits root access immediately. Game over.
The fix: dedicated service accounts with minimal permissions
Every daemon should run as its own unprivileged user. Modern distributions do this by default for Apache, nginx, and MySQL, but custom applications often don't.
Create a dedicated user:
useradd -r -s /bin/false -d /opt/myapp myapp
chown -R myapp:myapp /opt/myapp
Configure the service to drop privileges after binding to privileged ports. For a Node.js app behind nginx, run the Node process as myapp and let nginx (which does drop root) handle port 80.
Check what's running as root:
ps aux | grep ^root
Anything that isn't a core system service deserves scrutiny.
Mistake 4: Ignoring application and OS updates
Unpatched software is a standing invitation. Attackers scan the internet for known CVEs in WordPress, Drupal, PHP, OpenSSL, and kernel modules. Exploit code is public and automated.
The fix: automated updates for security patches
Enable unattended upgrades for security patches. On Debian and Ubuntu:
apt install unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
Edit /etc/apt/apt.conf.d/50unattended-upgrades to enable automatic security updates. Set email notifications so you know when patches are applied.
For applications, subscribe to security mailing lists and test updates in staging first. WordPress and its plugins should auto-update or be monitored with a tool like WP-CLI.
Check current patch status:
apt list --upgradable
If that list includes kernel or glibc packages and the server has been up for months, you're exposed.
Mistake 5: Leaving unnecessary services and ports open
Every listening service is attack surface. I've seen servers running FTP, Telnet, MySQL on 3306, and Redis on 6379—all reachable from the internet. Most weren't even being used.
The fix: firewall rules and service audits
Default-deny everything, then open only what you need. With ufw on Ubuntu:
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
For MySQL, PostgreSQL, or Redis, bind to 127.0.0.1 in the config so the service is unreachable from outside. If you must allow remote access, restrict by source IP.
Audit listening services:
ss -tulnp
Anything listening on 0.0.0.0 or :: is exposed to the world. Ask yourself if it needs to be.
Mistake 6: Using weak or default credentials everywhere
Weak passwords show up in database accounts, control panels, FTP users, and application admin accounts. Attackers know the common defaults—admin:admin, root:password, the database name as the password.
The fix: strong unique passwords and a password manager
Generate a random 20+ character password for every service. Store them in a password manager like Bitwarden or 1Password. For server access, use SSH keys and disable passwords entirely (see mistake 1).
For MySQL and PostgreSQL, set a strong root password and create role-specific accounts:
CREATE USER 'app'@'localhost' IDENTIFIED BY 'random-64-char-string';
GRANT SELECT, INSERT, UPDATE, DELETE ON appdb.* TO 'app'@'localhost';
The application should never connect as root. Rotate credentials after any team member departure.
Mistake 7: No monitoring or logging for intrusion attempts
Without logs you won't notice the reconnaissance phase. Attackers probe SSH, scan for web vulnerabilities, and test credentials. That activity leaves traces, but only if you're collecting and reviewing logs.
The fix: centralized logging and alerting
Ship logs to a separate system so an attacker cannot delete them. Options:
- Syslog forwarding to a dedicated log host or SIEM.
- Cloud logging like AWS CloudWatch, Datadog, or Papertrail.
- Fail2ban for immediate response to brute-force attempts.
Install and configure Fail2ban to watch SSH and web server logs:
apt install fail2ban
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Edit jail.local to set bantime, findtime, and maxretry. Enable jails for sshd and your web server. Restart Fail2ban and check banned IPs:
fail2ban-client status sshd
Review /var/log/auth.log and web server access logs weekly for patterns—repeated 404s on plugin paths, login attempts from unexpected countries, or port scans.
Mistake 8: Running a single point of failure with no incident response plan
When ransomware hits and you have no plan, panic sets in. Do we pay? Do we restore? From which backup? Who has access? In the scramble, teams make expensive mistakes—restoring an infected backup, wiping forensic evidence, or negotiating without legal counsel.
The fix: document your response runbook now
Write down the steps before the crisis. Your runbook should cover:
- Isolation: How to disconnect the infected system from the network without powering it off (pulling network cables, disabling interfaces).
- Notification: Who gets called and in what order—your team, your hosting provider, legal counsel, cyber insurance.
- Backup validation: Where backups are stored, how to verify they're clean, how to restore them.
- Forensics: Preserve logs and disk images before cleanup if you might pursue legal action or need to understand the breach.
- Communication: What to tell customers and when.
Test this plan. Run a tabletop exercise every six months.
Mistake 9: Trusting the network perimeter alone
Firewall rules and network segmentation help, but they're not enough. Attackers get inside through phished credentials, supply-chain compromises, or vulnerable applications. Once in, a flat network lets them move laterally.
The fix: zero-trust controls and application hardening
Assume the perimeter is breached. Apply defense in depth:
- SELinux or AppArmor to confine processes even if exploited.
- File integrity monitoring with tools like AIDE or Tripwire to detect unauthorized changes.
- Least privilege everywhere—database users, file permissions, sudo access.
- Network segmentation so the web tier cannot directly reach the database tier; traffic flows through an application server.
Enable SELinux on RHEL-based systems if it's disabled:
setenforce 1
Edit /etc/selinux/config and set SELINUX=enforcing. Expect some applications to break until you write or apply the correct policies. That friction is the point—unconfined execution should be hard.
Pulling it all together
Here's the seven-step checklist distilled:
- Harden SSH: Key-only auth, non-standard port optional, Fail2ban enabled.
- Isolate backups: Push to immutable object storage or pull from a separate host. Test restoration.
- Drop privileges: Run every service as a dedicated unprivileged user.
- Patch religiously: Automate OS security updates, monitor application CVEs, subscribe to vendor advisories.
- Minimize attack surface: Close unused ports, bind services to localhost, remove unnecessary software.
- Enforce strong authentication: Long random passwords, SSH keys, no defaults.
- Monitor and respond: Centralize logs, set up alerting, document your incident response runbook.
None of these steps is optional. Skipping even one leaves a door open.
Common questions
How often should I test backups?
Quarterly at minimum. Monthly is better. A backup you've never successfully restored is untested hope.
Can I use a VPN instead of SSH keys?
A VPN adds a second perimeter but doesn't replace key-based auth. Use both. Even inside a VPN, SSH should require keys.
What if I've already been hit?
Isolate immediately—disconnect network, don't power off. Notify your hosting provider and legal team. Restore from the most recent clean backup. Then go through this checklist so it doesn't happen again.
Do I really need SELinux if I have a firewall?
Yes. Firewalls control network traffic. SELinux controls what a compromised process can do after the attacker is already inside. Different layers.
What about paying the ransom?
Don't. You fund future attacks, there's no guarantee of decryption, and you may face legal or regulatory issues. Focus on prevention and tested backups instead.
Where most defenses actually fail
In my experience, the failure point is almost never a zero-day exploit. It's SSH passwords, stale WordPress plugins, or backups that weren't really offline. Fix those nine mistakes with the seven-step checklist and you'll be ahead of most targets. Attackers move to easier prey.
