Bobcares

How to Exclude Files from Backups in cPanel

While setting up backups in cPanel, it is important to exclude certain files from Backups. For instance, if the user’s home directory stores backups generated by WordPress plugins, then, they need to be removed from the cPanel backup routine.

As a part of Server Management Services, we help our customers with almost every task using WHM or cPanel interface.

Let us today see how to exclude certain files or folders from cPanel backup.


 

Why do we need to Exclude Files from Backups in cPanel?

Recently, we received a support request where the customer was complaining that the cPanel backups. Our Support Engineers noticed that customer had configured a WordPress plugin to generate a backup of the site. These backups were stored within user’s home directory.

Packaging these already compressed backups within another backup will not compress them further. However, it just inflates the size of the cPanel backup. Moreover, it consumes more disk space.

It is also important to exclude some files due to security reasons. Furthermore, error logs and other files not necessary for site restoration can also be excluded from the backup.
 

How to Exclude Files from Backups in cPanel ?

The exclude files can be set up in two different methods. We could either set up excludes for all users’ backups or for an individual user’s backups.

The global and local exclude files apply to the account backups that we manage in WHM’s Backup section (WHM >> Home >> Backup) and the “Download a Full Website Backup” feature in cPanel’s Backup interface (cPanel >> Home >> Files >> Backup).

If we initiate a Home Directory Backup in cPanel’s Backup interface (cPanel >> Home >> Files >> Backup), the global and local exclude files do not affect the contents of the backup file.

If we perform a backup with the /scripts/pkgacct script, the global and local exclude files do not affect the contents of the backup file.

The backup-exclude.conf files only apply to files or directories in a user’s home directory. They do not apply to files or directories outside of a user’s home directory.
 

Global exclude file

To exclude files or directories from backups for all user accounts, add those files or directories to the /etc/cpbackup-exclude.conf file. The /etc/cpbackup-exclude.conf file excludes the files that we specify relative to any location from which the backup script runs.

The backup system excludes the following files and directories for all users’ backups by default:

Exclude Files from Backups in cPanel
 

Local exclude file

To exclude files or directories from an individual user’s backups, add the desired paths (relative to the user’s home directory) to the cpbackup-exclude.conf file in the user’s home directory, with one entry per line.

If the file does not already exist, we must create it. To do this, run the following command:

# touch /home/username/cpbackup-exclude.conf

In this example, username represents the name of the user who owns the files or directories.

If we enter a directory name, the backup system excludes all of the files that exist in the directory.

When we specify files, do not include leading or trailing characters of any kind, such as slashes (/) or periods (.).

For example, to exclude the /home/username/example/ directory and the /home/username/dir/example.php file from the username user’s backups, create the following /home/username/cpbackup-exclude.conf file:

example/
dir/example.php

 
[Need any further assistance with cPanel backups? – We’re available 24*7]

Conclusion

In short, we would require to exclude certain files from backups in cPanel either for security purposes or to reduce the size of the backup file. Today we saw how our Support Engineers set up both global and local exclude files.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";
0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF