Skip to content

Cleaning the per-account .cpanel directory when usage looks wrong

How to safely clean stale data out of /home/USER/.cpanel, the per-account cache directory, when usage reports diverge from disk reality.

/home/<user>/.cpanel is the hidden directory where cPanel stashes per-account caches: caches.json files, datastore artifacts, nvdata for interface state, sometimes a stray older-version backup of a config. When a user reports their usage looks wrong and du -sh of public_html and mail doesn’t add up to the displayed total, the missing bytes are often in .cpanel.

What’s happening

cPanel writes session state, command output caches, and quota intermediate data into this directory. Most of it is regenerable. A few things are not — nvdata holds UI state like the last-used WHM interface tabs, which is annoying to lose but not damaging. The risk is in subdirectories used by third-party plugins (e.g. some imunify360 or SSL automation modules) that store working state there.

How to verify

Inspect before touching:

du -sh /home/<user>/.cpanel
du -sh /home/<user>/.cpanel/* | sort -h
find /home/<user>/.cpanel -type f -size +10M
ls -la /home/<user>/.cpanel/datastore/

A 4 GB .cpanel on a small account is almost always a runaway datastore or a forgotten file-manager temporary directory. Identify the heavy subdirectory before deleting wholesale.

The fix

  1. The safe pass: clear ~/.cpanel/datastore/ contents and ~/.cpanel/caches/*. These regenerate on next cPanel session. rm -rf /home/<user>/.cpanel/datastore/* /home/<user>/.cpanel/caches/*. Avoid removing .cpanel/nvdata unless you confirm what’s there.
  2. For the file manager temp directory (/home/<user>/.cpanel/cron_clearedcache_run and similar), inspect first — there may be uploads in progress.
  3. After cleanup, refresh the cPanel cache with /usr/local/cpanel/bin/quota_cache --user=<user> --rebuild and check the displayed usage matches du -sh /home/<user>.
  4. If usage still looks wrong, the candidate is ~/.trash (cPanel File Manager trash, separate from the OS) — du -sh /home/<user>/.trash and clean if confirmed.
  5. Document the cleanup in the ticket and the customer’s account notes. Repeated clean-the-cache passes on the same account suggest something is producing the bloat on a schedule — find the producer rather than rerunning the cleanup.

For shared servers where this cleanup is a regular interruption, Stack Harbor handles it under WHM server management as part of routine operations.