How to secure a web hosting server
What a hosting server needs beyond a firewall: two-step sign-in, SSH keys, account isolation, a web firewall, malware scans, updates and off-server backups.
Published
A hosting server runs other people's code, so it needs more than a firewall. Most attacks don't target you: they try stolen passwords, old plugins and open ports on every server they find. This guide lists what to switch on, in order, and why each step matters.
What is already on
A new Hfog Panel server starts with the firewall on, fail2ban banning addresses that keep guessing passwords, and every hosting account running as its own Linux user. On Ubuntu and Debian every website also sits behind a web application firewall.
Protect the sign-ins
Stolen passwords are the most common way in. Turn on two-step sign-in for yourself, with an authenticator app or a passkey (a passkey can't be phished), then make it required for administrators and resellers. Give every member of staff a login of their own, read-only unless they really need more, and never share the main one.
See Two-step sign-in.
Use SSH keys for root
Sign in to the server itself with an SSH key, then switch password sign-in for SSH off. Test the key in a second terminal before you close the first, so a mistake can't lock you out.
Close what you don't use
Review the firewall rules and delete any port you opened for a test. Block an address that attacks you from the whole server, and look at who fail2ban has banned.
See Firewall.
Keep accounts apart
One hacked website must not reach the others. Give each account a private view of the file system and its own
/tmp, hide other accounts' processes, and allow SFTP only unless a customer needs a shell. Enforce CPU and memory
limits, so one busy or hacked site can't slow the server down. A stricter setting is checked on the server before it
is applied.
See Account isolation.
Stop attacks on websites
Switch the web application firewall from logging to blocking, after a few days of logging if you want to check for false alarms first, and keep the nightly malware scan of every account on.
See Security overview and, when a site is hit, Restore a hacked WordPress site.
Stay up to date
Let the panel install its new versions at night, and check the server's health page for anything red or amber, such as a restart needed after system updates.
Keep a way back
A secure server still needs backups that leave it. Copy them to storage elsewhere every night and test that they restore.
See Back up off-server. The whole checklist, with every click, is in Secure the server in 15 minutes.
Try it on your own server
Install Hfog Panel and try every feature free for 30 days.