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:
- Access your server using SSH as the
rootuser or the Terminal in WHM -
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:
CONFIG_TEXT: */core.[0-9]
.MirrorSearch
.cpan
.cpanel/caches
.cpanel/datastore
.cpcpan
access-logs
public_ftp/.ftpquota
# add new entries here
example/
dir/example.phpNote: Paths are relative to the user's home folder.
- Save the file
-
You can test the exclusion by runing a manual backup using the pkgacct script and the
--userbackupflag:# scripts/pkgacct --userbackup $user
CPANEL_WARN: When performing a manual backup using
pkgacct, you must use the--userbackupflag to respect the exclusions.
Comments
0 comments
Article is closed for comments.