How to Exclude Files from Backups Print

  • 0

Question

How can I exclude certain files from cPanel backups automatically?

 

Answer

cPanel offers two methods for excluding files from the standard backup process.

  • System-wide exclude (applies to all users) - /etc/cpbackup-exclude.conf
  • Per-user exclude (applies to the configured user) - /home/$user/cpbackup-exclude.conf

Note: Replace $user with the cPanel username

Note: The exclusions only apply to files or directories in a user's home directory. They do not apply to files or directories outside a user's home directory.

To create or edit these files:

  1. Access your server using SSH as the root user or the Terminal in WHM
  2. Using your preferred text editor, create and edit the exclude file either for the system excludes or the user excludes. The following is an example of what you might place in the file:

    */core.[0-9]
     .MirrorSearch
     .cpan
     .cpanel/caches
     .cpanel/datastore
     .cpcpan
     access-logs
     public_ftp/.ftpquota
     # add new entries here
     example/
     dir/example.php

    Note: Paths are relative to the user's home folder.

  3. Save the file
  4. You can test the exclusion by runing a manual backup using the pkgacct script and the --userbackup flag:

    scripts/pkgacct --userbackup $user

     
    When performing a manual backup using pkgacct, you must use the --userbackup flag to respect the exclusions.

Resources

How to Exclude Files from Backups (cPanel Docs)


Was this answer helpful?
Back

Send Message