Cloud House Technologies Logo
CloudHouse Technologies
HomeServicesProjectsBlogAbout UsCareersContact UsLogin
    Cloud House Technologies Logo
    CloudHouse Technologies
    HomeServicesProjectsBlogAbout UsCareersContact UsLogin

    How to Exclude Files and Directories from cPanel/WHM Backups (Global & Per-Account)

    Priya

    Content Writer & Researcher

    Last Updated: 10 August 2026
    How to Exclude Files and Directories from cPanel/WHM Backups (Global & Per-Account)
    🖥️

    Wasting Storage on Unnecessary cPanel Backup Data? Let's Fix That

    Oversized backups slow down servers, fill storage, and cost money — without making restores more reliable. CloudHouse Technologies will audit your backup configuration, apply the right exclusions, and set up a lean backup strategy that protects what matters.

    🔧 Book Free DiagnosisCall NowWhatsApp
    🖥️12,400+PCs Fixed
    ⭐4.9★Google Rating
    ⚡<15 minAvg. Response
    🛡️ISO 27001Certified

    cPanel/WHM backups can balloon to many gigabytes when they include cache files, temporary data, log archives, and files that simply do not need to be backed up. Excluding the right files from backups reduces storage costs, speeds up the backup process, and makes restores faster. This guide covers every method available in cPanel/WHM for excluding files at the global and per-account level.

    Why Backup Exclusions Matter

    Before diving into configuration, it helps to understand what typically inflates backup size unnecessarily:

    • Cache directories: WordPress object cache, PHP OPcache dumps, CDN cache — regenerated automatically and never needed from a backup
    • Log files: Access logs, error logs, mail logs — often large and only useful for recent troubleshooting, not disaster recovery
    • Temporary files: Uploads in progress, session data, /tmp directories inside account home folders
    • Old backup archives: Home directories sometimes contain .tar.gz files that double the backup size
    • Node modules / vendor directories: These should be reconstructed from package.json or composer.json on deploy, not backed up

    Excluding these categories can reduce backup size by 30–70% on typical hosting accounts.

    💡 None of these worked? Skip the guesswork.

    Get Expert Help →

    Method 1: Global Exclusions for All Accounts (WHM Root)

    The global exclude file applies to every account on the server during cPanel/WHM backup runs.

    1Edit the global exclude file via SSH
    nano /etc/cpbackup-exclude.conf

    Add one path per line. Paths are relative to each account's home directory:

    # WordPress cache
    public_html/wp-content/cache
    public_html/wp-content/uploads/cache
    
    # Temporary and session files
    tmp
    .cache
    
    # Compiled/generated assets
    public_html/node_modules
    public_html/vendor
    
    # Log files
    logs
    access-logs
    
    # Archive files inside home directories
    *.tar.gz
    *.zip
    *.tar.bz2
    2Alternatively, use the WHM GUI

    Navigate to WHM → Backup → Backup Configuration → Files tab. You will see an editable text box for the global exclude list. Add paths in the same relative format and click Save.

    3Verify the file is correctly formatted
    cat /etc/cpbackup-exclude.conf

    Each line should be a relative path — do not use leading slashes. Wildcards (*) are supported.

    Important: The global exclude file applies to all accounts on the server. Be conservative — do not exclude directories that contain user data that could be needed for a restore.
    1Create the per-account exclude file

    As root (or the user), create ~/cpbackup-exclude.conf in the user's home directory:

    nano /home/username/cpbackup-exclude.conf

    Add relative paths (relative to the user's home directory):

    public_html/wp-content/cache
    public_html/.sass-cache
    public_html/uploads/temp
    mail/cur
    mail/new
    2Users can also manage this via cPanel

    cPanel users can navigate to Files → Backup → Configure Backup Exclusions (if available in their cPanel theme) to manage their own exclusion list without SSH access.

    3Set correct permissions
    chown username:username /home/username/cpbackup-exclude.conf
    chmod 644 /home/username/cpbackup-exclude.conf
    1Global exclusions in JetBackup

    Go to WHM → JetBackup → Backup Jobs → Select Job → Edit → Exclude Files. Add glob patterns for files or directories to exclude from all accounts in that backup job.

    2Per-user exclusions in JetBackup

    Go to WHM → JetBackup → Accounts → Select Account → Exclude Files. This lets you add user-specific exclusions without touching the global list.

    JetBackup also supports excluding by file extension, file size thresholds, and last-modified date — useful for excluding very large rarely-changed files automatically.

    Recommended Exclusion Patterns for Common CMS Platforms

    Here are production-tested exclusion patterns by platform:

    WordPress:

    public_html/wp-content/cache
    public_html/wp-content/uploads/cache
    public_html/wp-content/wflogs
    public_html/.htaccess.bak

    Magento 2:

    public_html/var/cache
    public_html/var/session
    public_html/var/tmp
    public_html/generated

    Laravel:

    public_html/storage/framework/cache
    public_html/storage/framework/sessions
    public_html/storage/logs
    public_html/vendor
    public_html/node_modules

    General (safe for all accounts):

    tmp
    .cache
    *.log
    *.log.gz

    Verifying Your Exclusions Work

    After adding exclusions, run a test backup and verify the excluded directories are not in the archive:

    # Run a manual backup for a test account
    /scripts/cpbackup --incremental
    
    # Once complete, inspect the backup archive
    tar -tzf /backup/cpbackup/daily/username/backup-*.tar.gz | grep "wp-content/cache"
    # Should return no results if exclusion worked

    Check backup logs for any exclusion-related messages:

    grep -i "exclude\|skip" /usr/local/cpanel/logs/cpbackup-cpbackuplog

    Monitoring Backup Size After Applying Exclusions

    Track the impact of your exclusions on storage usage:

    # Before and after comparison — check total backup directory size
    du -sh /backup/cpbackup/daily/
    
    # Per-account backup sizes
    du -sh /backup/cpbackup/daily/*/

    If backup sizes have not decreased significantly, review the exclusion file for path typos — paths that do not match any real directory are silently ignored.

    For comprehensive cPanel/WHM backup configuration, monitoring, and storage optimisation, CloudHouse Technologies' server management service includes proactive backup health checks as part of ongoing server management.

    FAQs

    Get the Free Linux Server Admin Cheatsheet (PDF)

    Essential commands for server management, networking, and troubleshooting — all on one printable page.

    Running Linux servers? Let us manage them for you.

    Our Managed Linux Server plans cover updates, security hardening, monitoring, and 24/7 incident response — so your servers stay up and your team stays focused.

    • Proactive OS patching and security updates
    • 24×7 monitoring with instant alerting
    • Backup configuration and disaster recovery
    • Dedicated Linux engineers on call
    See Pricing Plans →

    What our customers say

    “Our production server went down at 2 AM. CloudHouse had it back online in under 20 minutes. Incredible response time.”

    Arun S.

    CTO, SaaS Startup

    “They migrated our entire infrastructure from Ubuntu 18 to 22 with zero downtime. Couldn't have asked for better.”

    Deepak N.

    DevOps Lead

    Frequently Asked Questions

    Yes. The /etc/cpbackup-exclude.conf global file and each user's ~/cpbackup-exclude.conf apply to both full and incremental backups run by cPanel's built-in backup system. They do not apply to pkgacct manual packaging — use /etc/pkgacct-exclude.conf or ~/.pkgacct-exclude for that.

    Book your free 15-minute diagnosis

    A certified technician will call you back within 15 minutes during business hours.

    Share this article

    Leave a Comment

    Comments (0)

    Loading comments...

    Struggling With cPanel Backup Storage Costs?

    Most hosting servers waste 30–70% of backup storage on cache files and logs that will never be needed for a restore. CloudHouse Technologies specialises in WHM backup optimisation — we'll configure your exclusions correctly and monitor your backup health so you never lose critical data.

    Call Now — FreeWhatsApp Us

    Why CloudHouse?

    • ISO 27001:2022 certified
    • 12,400+ devices supported
    • 4.9★ on Google
    • Sub-15-minute response

    CloudHouse Technologies

    Innovative cloud solutions for modern businesses. We deliver cutting-edge technology with exceptional service.

    Contact Us

    CloudHouse Technologies Pvt.Ltd
    Special Economic Zone(SEZ),
    Infopark Thirissur,4B-15,
    Indeevaram,Nalukettu Road,
    Koratty, Kerala, India-680308
    0480-27327360
    info@cloudhousetechnologies.com

    Quick Links

    • Our Services
    • Gold Loan Software
    • About Us
    • Contact
    • Terms and Conditions
    • Privacy Policy
    ISO27001:2022
    Certified

    © 2026 CloudHouse Technologies Pvt.Ltd. All rights reserved.

    Back to top