Short answer: secure the cPanel account itself (strong password and Two-Factor Authentication in cPanel), keep WordPress, plugins, themes and the PHP version updated, enable AutoSSL and force HTTPS, set correct file permissions, use the host’s security tools such as Imunify360 or ModSecurity if offered, take off-server backups, remove old or unused WordPress installs, and avoid sharing one cPanel account across unrelated sites. A compromised cPanel account gives an attacker every site, database and email box in it.
cPanel is the most common control panel on shared and reseller hosting. It makes running WordPress easy, but it also means one account often holds several sites, mailboxes and databases. Attackers who break into one outdated site can frequently reach the others in the same account, which is why many shared-hosting infections spread from an old, forgotten install.

1. Protect the cPanel login
Use a long, unique password for cPanel and your hosting client area. In cPanel, open Security > Two-Factor Authentication and set it up with an authenticator app. Enable 2FA on the hosting billing account too, because it can usually reset cPanel access. Under Security > Manage API Tokens and SSH Access, remove tokens and SSH keys you no longer use.
2. HTTPS with AutoSSL
Most cPanel hosts provide free certificates through SSL/TLS Status (AutoSSL with Let’s Encrypt or Sectigo). Make sure all domains and subdomains are covered, then set WordPress and Site Address to https in Settings > General and enable an HTTPS redirect, either in cPanel’s Domains page (“Force HTTPS Redirect”) or with a rule in .htaccess.
3. Keep PHP and WordPress current
In MultiPHP Manager or Select PHP Version, choose a PHP version that is still supported by the PHP project; older versions no longer receive security fixes. Update WordPress core, plugins and themes regularly, and remove plugins and themes you do not use. See also setting up WordPress security headers.
4. File permissions and ownership
Typical safe settings are 755 for folders and 644 for files, with wp-config.php at 600 or 640 where your host supports it. Never set 777. You can check permissions in cPanel’s File Manager. On most modern cPanel servers, PHP runs as your own user (suPHP, PHP-FPM or similar), so files do not need to be world-writable.
5. Use the host’s security layers
- Imunify360 (on many hosts) scans files for malware, blocks malicious IPs and can clean infected files.
- ModSecurity is a web application firewall; leave it on unless a specific rule causes a problem, and ask support to whitelist only that rule.
- Directory Privacy can add password protection to wp-admin as an extra layer.
- IP Blocker lets you block persistent attackers.
6. Backups stored somewhere else
cPanel’s Backup or JetBackup tools are useful, but backups stored on the same server can be lost or infected with the site. Download full backups regularly or use a plugin that sends backups to remote storage. Test a restore occasionally.

7. Separate and clean up
Remove old WordPress installs in subfolders (staging copies, abandoned blogs, “old” folders). These are a frequent source of reinfection because nobody updates them. If you run sites for different clients or purposes, use separate cPanel accounts so a compromise in one cannot reach the others. Use a different database user and password for each site, with only the privileges needed.
8. Email and FTP accounts
Delete FTP accounts you no longer use and prefer SFTP. Use strong passwords for email accounts in cPanel, because spammers who compromise a mailbox can damage your domain’s reputation.
A monthly maintenance routine
Security on cPanel hosting is mostly about routine rather than one-time settings. Once a month, log in to cPanel and check that AutoSSL shows all domains as valid, that the PHP version is still supported, and that disk usage has not jumped unexpectedly, which can signal spam files or a backup loop. In WordPress, review the list of administrator users and remove anyone who no longer needs access, apply pending updates, and look at your security plugin’s log for repeated attacks. Download a fresh backup and store it away from the server. Finally, open File Manager and look for unfamiliar folders in public_html, such as old installs, test copies or files with random names. Ten minutes a month catches most problems before they become a full compromise.
cPanel settings at a glance
Menu names vary slightly between hosts and cPanel themes, but these are the places to check and the values to aim for.
| Area | Where in cPanel | Target setting |
|---|---|---|
| Login | Security > Two-Factor Authentication | On, with an authenticator app; also on the hosting billing account |
| HTTPS | Security > SSL/TLS Status, then Domains | Every domain and subdomain valid; Force HTTPS Redirect on |
| PHP version | MultiPHP Manager or Select PHP Version | A branch still listed on php.net’s supported versions page. PHP 8.2 receives security fixes only until 31 December 2026, so move to 8.3 or newer if your plugins support it. |
| File permissions | File Manager | 755 folders, 644 files, wp-config.php 600 or 640; never 777 |
| Firewall and malware scanning | Imunify360, ModSecurity (if offered) | Enabled; whitelist single rules only when needed |
| Backups | Backup or JetBackup | Regular backups, plus a copy stored off the server |
| Access | FTP Accounts, SSH Access, Manage API Tokens | Unused accounts, keys and tokens removed; SFTP rather than FTP |
Two WordPress-level hardening changes
Disable the built-in file editor. Add this line to wp-config.php above the “That’s all, stop editing” comment:
define( 'DISALLOW_FILE_EDIT', true );
It removes the theme and plugin editor from the dashboard, so an attacker who steals an admin password cannot simply paste PHP code into a theme file.
Block PHP in the uploads folder. The uploads folder should only hold images and documents, yet it is a common place for attackers to drop backdoors. On Apache or LiteSpeed servers, which most cPanel hosts use, create a file named .htaccess inside wp-content/uploads containing:
<FilesMatch "\.(php|phtml|php[0-9])$">
Require all denied
</FilesMatch>
Test the site afterwards, including image uploads and any plugin that generates files. If something breaks, remove the file and ask your host for an equivalent rule. Combined with the server tools above, these two changes close two of the most common ways a single stolen login turns into a full compromise. For login protection itself, see stopping WordPress brute force attacks.
Frequently asked questions
Is shared cPanel hosting safe for WordPress?
It can be, provided the host isolates accounts and you keep everything updated and remove old installs.
Should I use Softaculous to install WordPress?
It is convenient. Change the default admin username and table prefix during setup, and keep auto-updates on.
Do I still need a security plugin?
A plugin adds login protection and file monitoring at the WordPress level. It complements server tools.
What if Imunify360 finds malware?
Let it clean or quarantine files, then find and fix the cause, such as an outdated plugin. See cleaning a hacked WordPress site.



