Skip to content

How to Secure cPanel Step by Step

A practical guide to securing cPanel: a strong password and two-factor authentication, IP blocking, ModSecurity, AutoSSL and forced HTTPS, protecting directories and links, and backups, step by step.

Securityخالد الراشد28 min read
Illustration of a padlock guarding a control panel grid next to a phone with a verification code, representing securing a hosting panel
On this page

cPanel controls your files, databases, email, certificates and sometimes your DNS settings. This reference guide raises its security step by step, from the most important to the complementary, with reference tables, ready-made commands, a checklist and an incident response plan. Read it once in full, then use it as a work list to apply to your real account.

Why is securing cPanel a top priority?

Whoever controls cPanel controls everything: all the site files, the databases, the email accounts, the certificates and sometimes the DNS records. It is a single control panel that holds all the keys to your digital kingdom in one place, and that is precisely what makes it a tempting target. A single vulnerability here doesn't mean a broken page or a stolen post; it means the attacker takes complete control of your entire digital presence.

cPanel is a gateway to all your sites at once

Many users put several sites under one cPanel account (a primary domain + addon domains + subdomains). This is convenient for management, but it means that compromising the panel doesn't bring down one site but every site hosted under it in an instant. On shared hosting, the damage can even reach your neighbors on the same server through privilege escalation. That is why securing cPanel is not a technical luxury but the first line of defense protecting your whole investment.

What can an attacker do after logging in?

Once an attacker gets hold of your panel, you go from administrator to guest on your own site. They can plant backdoors in your files that stay active even after you change the password, send thousands of phishing emails from your mailboxes so your domain lands on blacklists, steal your customers' data from the database, redirect your visitors to malicious sites (defacement / redirect), or use your server for cryptocurrency mining or attacks on others. Worst of all, they may stay for weeks without you noticing. That is why we build security in layers, not with a single measure: each layer buys time and raises the cost of the attack for the attacker.

ThreatHow it happensCountermeasure
Password guessing (brute force)Repeated automated login attemptsStrong password + 2FA + cPHulk
Stolen/leaked passwordA leak from another site where you reused itUnique passwords + a password manager + 2FA
Web attacks (SQLi / XSS)Exploiting a vulnerability in a plugin or scriptModSecurity + updating the CMS
Uploading malicious files (web shell)An upload vulnerability + wrong permissions644/755 permissions + ModSecurity
Email spoofingMissing email authenticationSPF + DKIM + DMARC
Unencrypted accessA plain HTTP connection exposes login credentialsAutoSSL + forced HTTPS
Indexing of sensitive filesNo index file + indexing enabledDisable directory indexing
Data loss after a compromiseNo clean backupAutomatic off-server backups

The quick hardening list (most to least important)

Before the details, here is the roadmap. We ordered the measures by their ratio of security benefit to effort, so start at the top and don't jump down before completing the items above:

ActionPriorityImpact
A strong, unique passwordCriticalPrevents guessing and leaks
Two-factor authentication (2FA)CriticalStops stolen logins
cPHulk (brute force protection)CriticalBlocks automated guessing
Update contact info and account recoveryHighEnsures you can regain control
AutoSSL + forced HTTPSHighEncrypts every connection
ModSecurityHighBlocks web attacks
Correct file permissions (644/755)HighPrevents malicious uploads/edits
Email authentication (SPF/DKIM/DMARC)HighPrevents spoofing of your domain
Automatic off-site backupsHighEnsures recovery
Block suspicious IPsMediumReduces noise and attacks
Disable directory indexingMediumHides the file structure
Monitor logs regularlyMediumDetects compromises early

1. A strong password and two-factor authentication (the most important)

Most compromises start with a weak, reused or leaked password. This layer alone blocks the vast majority of attempts, so don't rush past it.

How do you build a password that can't be cracked?

The rule is simple: length matters more than complexity. A password of 16 random characters is far harder than 8 "complex" characters that are easy to guess. Follow these steps:

  1. In cPanel's Password & Security, set a long (16+ characters) and unique password that you don't use anywhere else (the built-in password generator helps, or use the Generate Password field).
  2. Don't derive the password from your name, your domain name, your date of birth or consecutive dictionary words; these are the first things guessing tools try.
  3. Don't reuse your cPanel password for your email, WordPress or FTP. Each service gets its own separate password.

Why a password manager is not a luxury

Remembering dozens of long, unique passwords is humanly impossible, and the practical result is that people reuse them. That is where disaster strikes: a leak from some random forum lets the attacker open your hosting panel. The solution is to use a password manager (such as Bitwarden, 1Password or KeePass) that generates and stores a unique password for each service, while you remember only one strong master password. This way every password is long, random and unique with no memory burden, and a leak at one service doesn't affect the rest.

Two-factor authentication (2FA): the layer that stops stolen credentials

Two-factor authentication requires, in addition to the password, a changing code from an app on your phone. Its impact is huge: even if your password leaks completely, the attacker cannot log in without your phone. Enable it right away:

  1. Open the Security section, then Two-Factor Authentication (2FA) in cPanel.
  2. Link it to an authenticator app such as Google Authenticator, Authy or Microsoft Authenticator by scanning the QR code.
  3. Enter the generated code to confirm, and save the recovery codes (backup codes) in a safe place off the phone in case you lose it.

An expert tip: avoid 2FA via text messages (SMS) if an app alternative is available, because SMS is vulnerable to SIM swapping. An authenticator app works offline and is more secure.

2. Update your contact details and enable account recovery

A gap many people overlook: the contact email in cPanel is outdated or points to an address on the same domain. Imagine your site is compromised and the recovery email lives on the compromised server: you lose every means of recovery at once.

Why an external recovery email is crucial

In Contact Information, set an email address outside your domain (such as Gmail or another provider's email) to receive security alerts and reset links. If the server is compromised and your domain's email is disabled, you still have an independent channel to regain control. Also enable login notifications and resource overage notifications so you receive alerts about any unusual activity.

Contact settingWhy it matters
A recovery email outside the domainRegain control if the domain's email goes down
Notification when the password changesInstant detection of any hijacking
Notification when resources are exceededAn early sign of malicious activity (spam/mining)
Updating your records with the providerSpeeds up verification when support restores the account

3. cPHulk and brute force protection

A brute force attack tries thousands of passwords automatically until one works. The direct defense against it is cPHulk Brute Force Protection (it is usually managed by the provider at the WHM level, so ask for it if it isn't enabled).

How does cPHulk work?

cPHulk monitors failed login attempts on cPanel, WHM, email and SSH, and automatically blocks any IP address that exceeds an attempt threshold within a time window. This turns guessing from "unlimited time and attempts" into "a dead end after a few attempts." On VPS servers where you have root, make sure you configure:

  • A sensible failed-attempt threshold (for example, 5 attempts within 5 minutes) before blocking.
  • A whitelist for your own static IP address so you don't lock yourself out.
  • An escalating block duration for repeat addresses.

If you are on a virtual private server and want to understand the difference in the level of control, see what is VPS hosting.

4. SSH and keys instead of passwords (if available)

If SSH access is available on your plan (common on VPS and managed hosting, rare on shared hosting), it is a powerful channel but a prime target for guessing. The golden rule: use SSH keys and disable password login.

Why is a key more secure than a password?

An SSH key is a cryptographic pair (public + private) that is practically impossible to guess, unlike a password that can be cracked by brute force. You generate the key from SSH Access › Manage SSH Keys in cPanel, or locally and then upload the public part. The local commands to generate a modern key:

bash
# Generate an ed25519 key pair (newer and more secure than old RSA)
ssh-keygen -t ed25519 -C "my-cpanel-key"

# Copy the public key to the server (if allowed)
ssh-copy-id -p 22 username@your-server-ip

After confirming that key login works, ask for password authentication for SSH to be disabled. On servers where you have root, it is recommended to move SSH from the default port 22 to a non-standard port to reduce automated guessing noise, and to disable direct root login (PermitRootLogin no).

SSH actionBenefit
Keys instead of passwordsPractically eliminates guessing
Disable password authenticationCloses the largest attack surface
Change the default port (VPS)Reduces automated noise
Disable direct root loginReduces the impact of any compromise

5. Restrict access to cPanel/WHM by IP

If you manage your panel from a static IP address (an office or a management server), you can restrict access to cPanel/WHM to specific addresses through the server settings or by asking your provider. This turns your panel from "open to the world" into "open to you alone," making guessing impossible from outside your approved addresses.

When does IP restriction suit you, and when doesn't it?

It suits you if you have a static address and a small team. It doesn't suit you if you manage from constantly changing addresses (travel, changing home internet), because you may lock yourself out. The middle ground: a whitelist for your service provider's address range, or relying on cPHulk + 2FA instead of strict restriction. Always balance security against locking yourself out of your own panel.

6. ModSecurity (web application firewall)

ModSecurity is a web application firewall (WAF) that inspects every incoming request and blocks common attack patterns, such as SQL injection (SQLi), cross-site scripting (XSS) and attempts to exploit known vulnerabilities, before they reach your site or your plugins. It is a proactive layer of defense that works silently.

What does ModSecurity actually block?

It relies on ready-made rulesets such as the OWASP Core Rule Set, which are continuously updated to cover emerging vulnerabilities. When a request matches a known attack pattern, it is blocked and logged without reaching your application. This is especially useful for WordPress sites, where plugins and vulnerabilities abound. Enable it from Security › ModSecurity if your provider offers it, and check its logs from time to time; if it blocks a legitimate request (a false positive), you can add an exception for a specific rule instead of disabling the whole firewall.

Remember: ModSecurity is a complementary layer, not a replacement. It doesn't replace a strong password, updating your plugins or correct permissions; it is an extra safety net on top of them.

7. Correct file permissions (644/755) and protecting wp-config

Wrong file permissions are one of the best-known and most ignored doors to a compromise. Loose permissions (such as 777) mean that any process on the server, including a malicious script uploaded by an attacker, can modify or execute your files.

The 644 rule for files and 755 for folders

The simple reference rule: files 644 (readable by everyone, writable by the owner only) and folders 755 (accessible by everyone, writable by the owner only). Never use 777 except temporarily for troubleshooting, and then restore it immediately. You set permissions from File Manager › Permissions or over SSH:

bash
# All folders to 755
find /home/user/public_html -type d -exec chmod 755 {} \;

# All files to 644
find /home/user/public_html -type f -exec chmod 644 {} \;

# Tighten the sensitive WordPress configuration file
chmod 600 /home/user/public_html/wp-config.php
ItemRecommended permissionReason
Folders (directories)755Access for everyone, write for the owner only
Public files (.php/.html)644Read for everyone, write for the owner
wp-config.php600 (or 640)Contains the database credentials and keys
.htaccess644Readable by the server, protected from public modification
The wp-content/uploads folder755Needs write access for uploads, but no script execution

Why is wp-config your most dangerous file?

The wp-config.php file contains the database name, its user and password, and the security keys (salts). Leaking it means handing over your database. Tighten its permission to 600, and block access to it through .htaccess. For a deeper understanding of WordPress's structure and how to secure it, see the complete WordPress guide.

8. Protecting wp-admin and .htaccess

The WordPress dashboard (/wp-admin/ and wp-login.php) is one of the targets most exposed to guessing. Add a layer of protection on top of it with the .htaccess file.

Protecting wp-login with an extra password

The simplest effective protection: Directory Privacy in cPanel to protect the wp-admin folder with an extra password (HTTP Auth), so the attacker faces two gates instead of one. You can also restrict access to wp-login.php to your own IP address through .htaccess:

apache
# Restrict wp-login.php to a specific IP address
<Files wp-login.php>
  Require ip 203.0.113.10
</Files>

# Block direct access to wp-config.php
<Files wp-config.php>
  Require all denied
</Files>

# Block PHP execution inside the uploads folder
<FilesMatch "\.(php|phtml)$">
  Require all denied
</FilesMatch>

Put the last PHP-blocking block in an .htaccess file inside wp-content/uploads: it prevents any malicious script uploaded to the media folder from running, which is a very common compromise scenario.

9. AutoSSL and forced HTTPS

An unencrypted (HTTP) connection exposes login credentials and visitor data to anyone eavesdropping on the network. Make sure AutoSSL is enabled and that all your domains and subdomains carry a valid certificate, then force the redirect to HTTPS across the board.

AutoSSL issues and renews free certificates automatically, so they don't expire unexpectedly. After enabling it, turn on the "Force HTTPS Redirect" option if available, or add the rule in .htaccess. The full steps (checking the certificate, forcing the redirect, dealing with mixed content) are in installing an SSL certificate and enabling HTTPS.

10. Block suspicious addresses (IP Blocker)

With the IP Blocker tool you can block IP addresses or ranges that show hostile behavior (repeated login attempts, suspicious requests in the logs). It is useful for quickly stopping a recurring source of attacks.

But don't rely on it alone: professional attackers change their addresses and spread their attacks across thousands of addresses (botnets). Treat it as a tactical tool for putting out specific fires, while cPHulk + 2FA + ModSecurity remain the structural defense.

Firewall toolLevelWhat it protects
cPHulkServer/accountLogin guessing (cPanel/WHM/email/SSH)
ModSecurityWeb applicationSQLi, XSS, vulnerability exploits
IP Blocker (cPanel)AccountManually blocking specific addresses
CSF (ConfigServer)Server (VPS)A full firewall + intrusion detection
Forced HTTPS / AutoSSLTransportEavesdropping on the connection

Note: CSF (ConfigServer Security & Firewall) is a powerful tool, but it is managed at the server (root) level, so it is an option for those with a VPS or a dedicated server, not for shared hosting. To understand which type of hosting gives you this control, see shared, VPS and managed hosting.

11. Protect directories and disable indexing

ActionBenefit
Directory Privacy (password protection)Restricts access to sensitive folders
Disable directory indexingPrevents listing a folder's contents when there is no index file
Hotlink ProtectionPrevents theft of bandwidth for your images
Leech ProtectionDetects sharing of leaked login credentials

Why is directory indexing a silent danger?

When a folder has no index file and indexing is enabled, the server shows any visitor a list of all the files inside it. This exposes your site's structure, the names of your backups, configuration files and sensitive paths that nobody was supposed to see. Disable Directory Indexing from the Indexes tool in cPanel, or add Options -Indexes to .htaccess. Hotlink Protection stops other sites from embedding your images directly and draining your bandwidth, and Leech Protection detects when the login credentials for a protected area have leaked and are being shared by many people.

12. Backups through cPanel

Backups are not a preventive security measure but the last line of recovery. When all the previous layers fail, a clean backup is the difference between "we restored the site in an hour" and "we lost everything."

The golden rule: a copy off the server

A backup that lives on the server itself is not real protection: it is lost along with the server in a compromise or a disk failure. Follow the 3-2-1 rule: three copies, on two different media, one of them off-site. In cPanel, use Backup / Backup Wizard to create a full backup, and enable automatic backups that upload copies to a remote destination (FTP or cloud) if your provider offers it.

Backup typeContentsUse
Full backupFiles + databases + email + settingsFull restore after a disaster
Partial backup (home directory)Site files onlyQuick restore of a file/folder
Database backupMySQL tables onlyAfter a mistaken content change
Off-site backupFull, at a remote destinationProtection against failure of the server itself

An expert tip: test restoring your backup regularly. A backup that has never been test-restored may be corrupted without your knowing, and you'll find out at the worst possible moment.

13. Updates: cPanel, the system and the CMS

Outdated software is a set of published vulnerabilities waiting to be exploited. Every security update closes a door that someone discovered. Make updating a habit, not an event.

Leave server updates on automatic

On shared and managed hosting, the provider takes care of cPanel and operating system updates automatically, which is one of the most important reasons to choose managed hosting. On a VPS where you have root, enable automatic cPanel updates from Update Preferences in WHM, and update the system packages regularly. The application layer (WordPress, plugins, themes), however, is always your responsibility: enable automatic updates for trusted plugins, and review major updates manually. Most WordPress compromises come from an outdated plugin with a known vulnerability.

14. Managing databases and users with least privilege

The principle of least privilege means that every user and every service gets the absolute minimum permissions it needs, and no more. Applying it to databases reduces the impact of any compromise.

Why not give the database user all privileges?

In MySQL Databases, create a separate database user for each site with a strong, unique password, and grant it privileges on its own database only, not on all databases. Avoid granting administrative privileges (DROP, GRANT) to a user who only needs normal reading and writing. That way, if a site is compromised through a SQL injection vulnerability, the damage stays confined to its database and doesn't spread to your other sites. Also delete any old database users who are no longer in use: every active account is an extra attack surface.

15. Secure your email: SPF, DKIM and DMARC

Email is a double-edged sword: a work tool and a gateway for compromise. Spoofing of your domain's email means an attacker sends messages that appear to come from you, whether phishing or spam, so your name suffers and your domain ends up on blacklists.

How do you stop your domain from being spoofed?

Three DNS records form the line of defense:

  • SPF specifies the servers authorized to send on behalf of your domain, so receiving servers reject any message from a source that isn't listed.
  • DKIM signs your messages cryptographically, proving that they haven't been altered and that they really come from your domain.
  • DMARC ties the two together, tells the recipient what to do with messages that fail (reject/quarantine/report), and sends you reports about spoofing attempts.

These records are set in DNS, not directly inside cPanel, and they are fully explained in DNS records explained. Also keep an eye on Email Deliverability in cPanel, which reveals gaps in your email authentication and suggests fixes. And use strong passwords for every email account, because a compromised mailbox is used to send spam from your server.

Email authentication recordWhat it doesEffect when missing
SPFSpecifies the authorized sending serversYour domain is easy to spoof
DKIMA cryptographic signature for messagesNo proof of message integrity
DMARCPolicy for handling failures + reportsNo visibility and no real protection

16. Monitoring logs (Raw Access / Error Logs)

Security is not a setting you configure once and forget; it is continuous monitoring. The logs are your eyes on what is actually happening on your server.

What do you look for in the logs?

  • Raw Access Logs: a record of every request that reached your site (address, time, response). Look for repeated requests to wp-login.php, attempts to reach sensitive paths, or suspicious IP addresses with abnormal intensity.
  • Errors / Error Log: PHP and server errors. Sudden or strange errors may indicate an ongoing exploitation attempt.
  • Visitors / Bandwidth: sudden spikes in traffic or bandwidth may mean a DDoS attack or a malicious script draining your resources.

Review them regularly: at least weekly, and daily if your site is sensitive. Unfamiliar activity (logins from countries you don't deal with, new files you didn't upload, a spike in outgoing email) is your early warning before the compromise gets worse.

17. Remove what you don't use

Every enabled feature, every old file and every abandoned subdomain is an extra attack surface with no benefit. The principle of reducing the attack surface says: if you don't need it, delete it.

Review regularly and remove: subdomains you no longer use, old WordPress installations or test scripts, disabled plugins and themes (a disabled plugin that's out of date is still a potential vulnerability), FTP and email accounts that are no longer active, and backup files uploaded to public_html with easy-to-guess names. Every item you remove reduces the chance that an attacker finds a door in it.

What should you do if your panel is compromised? (Response plan)

Early detection is half the battle, and an organized response is the other half. If signs of a compromise appear (strange redirects, unknown files, a warning from Google, heavy outgoing email), act in this order:

  1. Contain immediately: change all passwords (cPanel, FTP, databases, email, the WordPress dashboard) from a clean device. Enable 2FA if it isn't already enabled.
  2. Isolate: if possible, put the site in maintenance mode or suspend it temporarily to stop the damage from spreading and to protect visitors.
  3. Investigate: review the logs to determine the time of the first intrusion and the path that was exploited, and inspect recently modified files and suspicious files (PHP shells).
  4. Clean from a good copy: restore from a backup taken before the compromise instead of attempting manual cleanup, which can miss a backdoor. Then update everything.
  5. Close the hole: fix the root cause (an outdated plugin, a wrong permission, a weak password), or the compromise will happen again right away.
  6. Monitor afterwards: watch the logs and outgoing email for weeks to make sure everything is completely clean, and request removal of your site from blacklists if it ended up on any.
IndicatorPossible meaningFirst action
Redirects to a strange siteInjection into the files/databaseIsolate + inspect modified files
A sudden surge of outgoing emailA compromised mailbox/spamChange email passwords + check cPHulk
Unknown .php filesA backdoorRestore from a clean backup
A Google "dangerous site" warningMalware detectedFull cleanup + request a review
An unexplained resource spikeMining/a malicious scriptInspect processes + logs

Common mistakes

  • One password for everything (cPanel + email + WordPress + FTP): a single leak opens them all.
  • Disabling 2FA "temporarily" and forgetting to turn it back on.
  • Relying on ModSecurity alone without a strong password and correct permissions.
  • 777 permissions on files and folders "to fix a problem quickly," then forgetting them.
  • A recovery email that lives on the same domain, so you lose it along with the server.
  • Backups that live on the server itself (not real protection), or a backup whose restore has never been tested.
  • Old, disabled plugins and themes left in place instead of being deleted.
  • Ignoring the access logs until a compromise happens.

Troubleshooting

ProblemLikely causeFix
Locked out of cPanel after IP restrictionYour address changed or a whitelist mistakeContact support to lift the restriction temporarily
Lost your 2FA phoneNo access to the authenticator appUse your saved recovery codes or contact support
ModSecurity blocks a legitimate actionAn overly strict rule (false positive)Add an exception for the specific rule; don't disable the firewall
The site won't open after setting permissionsA wrong permission on a system folder/fileReset folders to 755 and files to 644
Your messages go to spamMissing SPF/DKIM/DMARCSet the authentication records in DNS
AutoSSL doesn't issue a certificateThe domain doesn't point to the server yetCheck DNS, wait for propagation, then retry

The final security checklist

Use this list as a regular (monthly) review of your cPanel account:

ItemCheck
A strong, unique cPanel password (16+ characters)☐
2FA enabled + recovery codes saved☐
cPHulk enabled (or confirmed by the provider)☐
An up-to-date recovery email outside the domain☐
AutoSSL enabled + HTTPS forced on all domains☐
ModSecurity enabled☐
File permissions 644, folders 755 + wp-config 600☐
wp-admin protected + .htaccess rules applied☐
SPF + DKIM + DMARC configured☐
Automatic off-server backups + restore tested☐
cPanel/system/CMS updates active☐
Database users with least privilege☐
Directory indexing disabled☐
Old subdomains/files/plugins deleted☐
Logs reviewed regularly☐

Conclusion

cPanel security is layers, not a single measure. Start with the most important (a strong, unique password, 2FA and cPHulk), because these alone block the overwhelming majority of attempts. Then lock down the rest: an external recovery email, AutoSSL and forced HTTPS, ModSecurity, 644/755 permissions and protecting wp-config, email authentication (SPF/DKIM/DMARC), least privilege for databases, IP blocking and disabling indexing. And always finish with tested off-site backups and regular log monitoring, with a response plan ready in case the worst happens. No single layer is enough on its own, but together they make compromising you very expensive, and that is the goal. If your site runs on WordPress, complete the picture by securing it with the complete WordPress guide.

Frequently asked questions

What is the most important step to secure cPanel? A strong, unique password + two-factor authentication (2FA). Most compromises start with a weak or stolen password, and 2FA stops the login even if the password leaks completely. Start with this layer before anything else.

What is ModSecurity, and why should I enable it? It is a web application firewall (WAF) that inspects incoming requests and blocks common attack patterns such as SQL injection and XSS before they reach your site. Enable it from the Security section if your provider offers it. Remember that it is a complementary layer, not a replacement for a strong password and correct permissions.

What is the difference between cPHulk and ModSecurity? cPHulk protects against login guessing (brute force) on cPanel, WHM, email and SSH by blocking addresses after many failed attempts. ModSecurity inspects the content of web requests and blocks application attacks such as SQLi and XSS. They work on two different layers, and you need both.

What are the correct permissions for my site's files? Files 644 and folders 755 as a general rule, with wp-config.php tightened to 600. Never use 777, except temporarily for troubleshooting, and then restore the correct permission immediately, because 777 allows any malicious script to modify your files.

Do I need SSL inside cPanel? Yes. Enable AutoSSL to issue a free certificate automatically for all your domains, then force HTTPS. An unencrypted connection exposes login credentials and visitor data to any eavesdropper. The details are in the guide installing an SSL certificate and enabling HTTPS.

How do I prevent spoofing of my domain's email? By setting three DNS records: SPF specifies the authorized sending servers, DKIM signs your messages cryptographically, and DMARC ties the two together and sets the policy for handling failures. They are fully explained in DNS records explained.

Is two-factor authentication via SMS enough? An authenticator app is more secure than SMS, because text messages are vulnerable to SIM swapping. Use an app such as Google Authenticator or Authy whenever available, and keep your recovery codes in a safe place.

Where should I store backups? Off the server (cloud or separate storage), following the 3-2-1 rule: three copies, on two media, one off-site. A backup that lives on the server itself is lost with it in a compromise or failure, so it doesn't count as real protection. And test restoring your backup regularly.

How do I detect a cPanel compromise early? Monitor the access logs (Raw Access) and error logs, enable login and resource-overage notifications, and review email accounts and unusual files regularly. Unfamiliar activity, such as logins from strange locations, new files or a spike in outgoing email, is an early warning sign.

What should I do as soon as I discover a compromise? Change all passwords from a clean device and enable 2FA, isolate the site temporarily, investigate the logs to identify the path that was exploited, restore from a backup taken before the compromise, close the root vulnerability, then monitor for weeks to make sure everything is completely clean, and get your site removed from blacklists if necessary.

Are cPanel measures alone enough to protect my site? No. cPanel secures the gateway, but your site's security also requires securing the application layer (WordPress, its plugins and themes) and choosing suitable hosting. For sensitive sites, consider managed hosting or a VPS for deeper control; see shared, VPS and managed hosting.

Frequently asked questions

What is the most important step to secure cPanel?

A strong, unique password + two-factor authentication (2FA). Most compromises start with a weak or stolen password, and 2FA stops the login even if the password leaks completely. Start with this layer before anything else.

What is ModSecurity, and why should I enable it?

It is a web application firewall (WAF) that inspects incoming requests and blocks common attack patterns such as SQL injection and XSS before they reach your site. Enable it from the Security section if your provider offers it. Remember that it is a complementary layer, not a replacement for a strong password and correct permissions.

What is the difference between cPHulk and ModSecurity?

cPHulk protects against login guessing (brute force) on cPanel, WHM, email and SSH by blocking addresses after many failed attempts. ModSecurity inspects the content of web requests and blocks application attacks such as SQLi and XSS. They work on two different layers, and you need both.

What are the correct permissions for my site's files?

Files 644 and folders 755 as a general rule, with wp-config.php tightened to 600. Never use 777, except temporarily for troubleshooting, and then restore the correct permission immediately, because 777 allows any malicious script to modify your files.

Do I need SSL inside cPanel?

Yes. Enable AutoSSL to issue a free certificate automatically for all your domains, then force HTTPS. An unencrypted connection exposes login credentials and visitor data to any eavesdropper. The details are in the guide to installing an SSL certificate and enabling HTTPS.

How do I prevent spoofing of my domain's email?

By setting three DNS records: SPF specifies the authorized sending servers, DKIM signs your messages cryptographically, and DMARC ties the two together and sets the policy for handling failures. They are fully explained in DNS records explained.

Is two-factor authentication via SMS enough?

An authenticator app is more secure than SMS, because text messages are vulnerable to SIM swapping. Use an app such as Google Authenticator or Authy whenever available, and keep your recovery codes in a safe place.

Where should I store backups?

Off the server (cloud or separate storage), following the 3-2-1 rule: three copies, on two media, one off-site. A backup that lives on the server itself is lost with it in a compromise or failure, so it doesn't count as real protection. And test restoring your backup regularly.

How do I detect a cPanel compromise early?

Monitor the access logs (Raw Access) and error logs, enable login and resource-overage notifications, and review email accounts and unusual files regularly. Unfamiliar activity, such as logins from strange locations, new files or a spike in outgoing email, is an early warning sign.

What should I do as soon as I discover a compromise?

Change all passwords from a clean device and enable 2FA, isolate the site temporarily, investigate the logs to identify the path that was exploited, restore from a backup taken before the compromise, close the root vulnerability, then monitor for weeks to make sure everything is completely clean, and get your site removed from blacklists if necessary.

Are cPanel measures alone enough to protect my site?

No. cPanel secures the gateway, but your site's security also requires securing the application layer (WordPress, its plugins and themes) and choosing suitable hosting. For sensitive sites, consider managed hosting or a VPS for deeper control; see shared, VPS and managed hosting.