How to Exclude Files and Directories from Backups in cPanel & WHM

This guide explains how to exclude specific files or directories from user backups in cPanel & WHM. You can exclude items globally for all accounts or locally for individual users. These exclusions apply to WHM‑generated backups and full website backups in cPanel.

cPanel backup excludecpbackup-exclude.confWHM backup configuration

~2 min read • Updated Feb 15, 2026

How to Exclude Files from Backups


Valid for versions 82 through the latest version


Version: 82
Last modified: April 17, 2023


Overview


You can exclude files or directories from backups in two ways:

  • Exclude items from all users’ backups (Global Exclude)
  • Exclude items from a specific user’s backups (Local Exclude)

Both global and local exclude files apply to:

  • Backups generated in WHM (WHM » Home » Backup)
  • The Download a Full Website Backup feature in cPanel (cPanel » Home » Files » Backup)

Important Notes:

  • Home Directory backups created in cPanel ignore exclude files.
  • Backups created using /scripts/pkgacct also ignore exclude files.
  • Exclude files only apply to content inside a user’s home directory.

Global Exclude File


To exclude files or directories from backups for all users, add the paths to:

/etc/cpbackup-exclude.conf

This file excludes paths relative to the directory from which the backup script runs.


Default global exclusions include:


*/.wysiwygPro_*
*/core.[0-9]
.MirrorSearch
.cpan
.cpanel/caches
.cpanel/datastore
.cpcpan
.sqmailattach
access-logs
public_ftp/.ftpquota

Local Exclude File


To exclude files or directories from a specific user’s backups, add the paths (relative to the user’s home directory) to:

/home/username/cpbackup-exclude.conf

If the file does not exist, create it:

touch /home/username/cpbackup-exclude.conf

Notes:

  • Paths must be relative to the user’s home directory.
  • If you specify a directory, all files inside it will be excluded.
  • Do not include leading or trailing slashes or periods.

Example


To exclude the directory /home/username/example/ and the file /home/username/dir/example.php, your exclude file should contain:


example
dir/example.php

Conclusion


Using global and local exclude files gives you precise control over what gets included in user backups. This is especially useful for excluding cache files, logs, temporary data, or large directories that do not need to be backed up.


Written & researched by Dr. Shahin Siami