Configuring a server properly on day one is only half the job. Over time new services appear, temporarily opened ports stay open, developers come and go, and their old keys remain behind. It helps to treat security as a list you review regularly. The checklist below assumes an Ubuntu or Debian VPS and gives a command for each item. Go through it monthly or after any major change.
Access control
Root login and password authentication should be off, with SSH keys only. Check the effective configuration, which merges all config files:
sudo sshd -T | grep -E 'permitrootlogin|passwordauthentication'
Both should read no. Then review every user's authorised keys and the sudo group. A former developer's key left in ~/.ssh/authorized_keys is extremely common; labelling keys with owner and device makes clean-up easy. Services such as PHP-FPM should run as separate users without sudo.
sudo cat /home/*/.ssh/authorized_keys /root/.ssh/authorized_keys 2>/dev/null
getent group sudo
Network and open ports
sudo ss -tulpn
sudo ufw status numbered
Anything listening on 0.0.0.0 or [::] is reachable on all interfaces. Databases, Redis and app servers should listen on 127.0.0.1 only; for MySQL that is bind-address = 127.0.0.1. If remote database access is needed, use an SSH tunnel or allow a single IP in the firewall.
Updates
systemctl status unattended-upgrades
apt list --upgradable
ls /var/run/reboot-required 2>/dev/null && echo "Reboot needed"
System packages are only part of the picture. WordPress, Joomla, OpenCart and their plugins are not updated by apt, and many compromises start with an outdated plugin. Review versions monthly and delete, not just deactivate, unused plugins.
Brute force and suspicious activity
sudo fail2ban-client status sshd
last -a | head -20
sudo journalctl -u ssh --since "7 days ago" | grep -i accepted
A successful login at an odd hour or from an unknown address needs immediate attention. On some systems the unit is called sshd rather than ssh. Also glance at top for unfamiliar processes pinning the CPU.
Files and permissions
Use 755 for directories, 644 for files, tighter permissions for secrets like wp-config.php or .env, and never 777. Make sure secrets are not served over the web:
curl -s -o /dev/null -w "%{http_code}\n" https://example.uz/.env
curl -s -o /dev/null -w "%{http_code}\n" https://example.uz/.git/config
Both should return 403 or 404. Disabling PHP execution in upload folders is also worthwhile.
Backups that actually restore
Backups must live off the server, run automatically and be test-restored now and then. A private school in Fergana runs its grade system on a VPS: the database is dumped nightly with mysqldump and shipped elsewhere, and once a month the admin restores it on a test server. When a disk failed, the school lost at most one day of data because the restore had been rehearsed.
Monitoring
df -h
uptime
sudo journalctl -p err --since today
Full disks, usually from logs or old backups, can stop a database. If you use certbot, confirm renewals with sudo certbot renew --dry-run.
| Area | Check | Expected |
|---|---|---|
| SSH | sshd -T | no root, no passwords |
| Keys | authorized_keys | current staff only |
| Ports | ss -tulpn | databases on 127.0.0.1 |
| Updates | apt list --upgradable | nothing pending |
| Backups | test restore | latest copy opens |
If maintaining all of this yourself is too much, shared hosting with provider-managed security may suit a simple site better. On sayt.uz both VPS and hosting are managed from the cabinet, and support is available through tickets.