{"id":228,"date":"2021-07-23T12:25:57","date_gmt":"2021-07-23T12:25:57","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/how-to-exclude-files-from-backups\/"},"modified":"2021-07-23T12:25:57","modified_gmt":"2021-07-23T12:25:57","slug":"how-to-exclude-files-from-backups","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/how-to-exclude-files-from-backups\/","title":{"rendered":"How to Exclude Files from Backups"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\">\n<div id=\"versioned-article-header\">\n<p class=\"valid-version-info\"><em>Valid for versions 82 through the latest version<\/em><\/p>\n<\/div>\n<div id=\"version-select-group\" aria-label=\"select versions\">\n<h4>Version:<\/h4>\n<h4>82<\/h4>\n<\/div><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<p>To exclude files or directories from your user backups, perform either of the following actions:<\/p>\n<ul>\n<li>\n<p>Exclude the files from all users\u2019 backups<\/p>\n<\/li>\n<li>\n<p>Exclude the files from an individual user\u2019s backups.<\/p>\n<\/li>\n<\/ul>\n<p>The global and local exclude files apply to the account backups that you manage in WHM\u2019s <em>Backup<\/em> section (<em>WHM &gt;&gt; Home &gt;&gt; Backup<\/em>) and the <em>Download a Full Website Backup<\/em> feature in cPanel\u2019s <em>Backup<\/em> interface (<em>cPanel &gt;&gt; Home &gt;&gt; Files &gt;&gt; Backup<\/em>).<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>\n<p>If you initiate a <em>Home Directory<\/em> backup in cPanel\u2019s <em>Backup<\/em> interface (<em>cPanel &gt;&gt; Home &gt;&gt; Files &gt;&gt; Backup<\/em>), the global and local exclude files do <strong>not<\/strong> affect the contents of the backup file.<\/p>\n<\/li>\n<li>\n<p>If you perform a backup with the <code>\/scripts\/pkgacct<\/code> script, the global and local exclude files do <strong>not<\/strong> affect the contents of the backup file.<\/p>\n<\/li>\n<li>\n<p>The <code>backup-exclude.conf<\/code> files <strong>only<\/strong> apply to files or directories in a user\u2019s home directory. They do <strong>not<\/strong> apply to files or directories outside of a user\u2019s home directory.<\/p>\n<\/li>\n<\/ul><\/div>\n<\/div>\n<h2 id=\"global-exclude-file\">Global exclude file<\/h2>\n<p>To exclude files or directories from your backups for all user accounts, add those files or directories to the <code>\/etc\/cpbackup-exclude.conf<\/code> file. The <code>\/etc\/cpbackup-exclude.conf<\/code> file excludes the files that you specify relative to any location from which the backup script runs.<\/p>\n<p>The backup system excludes the following files and directories for all users\u2019 backups by default:<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 2\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 3\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 4\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 5\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 6\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 7\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 8\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 9\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">10\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"color:#f92672\">*\/<\/span>.<span style=\"color:#a6e22e\">wysiwygPro_<\/span><span style=\"color:#f92672\">*<\/span>\n<span style=\"color:#f92672\">*\/<\/span><span style=\"color:#a6e22e\">core<\/span>.[<span style=\"color:#ae81ff\">0<\/span><span style=\"color:#f92672\">-<\/span><span style=\"color:#ae81ff\">9<\/span>]\n.<span style=\"color:#a6e22e\">MirrorSearch<\/span>\n.<span style=\"color:#a6e22e\">cpan<\/span>\n.<span style=\"color:#a6e22e\">cpanel<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">caches<\/span>\n.<span style=\"color:#a6e22e\">cpanel<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">datastore<\/span>\n.<span style=\"color:#a6e22e\">cpcpan<\/span>\n.<span style=\"color:#a6e22e\">sqmailattach<\/span>\n<span style=\"color:#a6e22e\">access<\/span><span style=\"color:#f92672\">-<\/span><span style=\"color:#a6e22e\">logs<\/span>\n<span style=\"color:#a6e22e\">public_ftp<\/span><span style=\"color:#f92672\">\/<\/span>.<span style=\"color:#a6e22e\">ftpquota<\/span><\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<h2 id=\"local-exclude-file\">Local exclude file<\/h2>\n<p>To exclude files or directories from an individual user\u2019s backups, add the desired paths (relative to the user\u2019s home directory) to the <code>cpbackup-exclude.conf<\/code> file in the user\u2019s home directory, with one entry per line.<\/p>\n<p>If the file does not already exist, you <strong>must<\/strong> create it. To do this, run the following command:<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-bash\" data-lang=\"bash\">touch \/home\/username\/cpbackup-exclude.conf<\/code><\/pre>\n<\/div>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>\n<p>In this example, <code>username<\/code> represents the name of the user who owns the files or directories.<\/p>\n<\/li>\n<li>\n<p>If you enter a directory name, the backup system excludes all of the files that exist in the directory.<\/p>\n<\/li>\n<li>\n<p>When you specify files, do <strong>not<\/strong> include leading or trailing characters of any kind, such as slashes (<code>\/<\/code>) or periods (<code>.<\/code>).<\/p>\n<\/li>\n<\/ul><\/div>\n<\/div>\n<h2 id=\"example\">Example<\/h2>\n<p>For example, to exclude the <code>\/home\/username\/example\/<\/code> directory and the <code>\/home\/username\/dir\/example.php<\/code> file from the <code>username<\/code> user\u2019s backups, create the following <code>\/home\/username\/cpbackup-exclude.conf<\/code> file:<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">2\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"color:#a6e22e\">example<\/span><span style=\"color:#f92672\">\/<\/span>\n<span style=\"color:#a6e22e\">dir<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">example<\/span>.<span style=\"color:#a6e22e\">php<\/span><\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Valid for versions 82 through the latest version Version: 82 Overview To exclude files or directories from your user backups, perform either of the following actions: Exclude the files from all users\u2019 backups Exclude the files from an individual user\u2019s backups. The global and local exclude files apply to the account backups that you manage &hellip;<\/p>\n","protected":false},"author":1,"featured_media":229,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/228"}],"collection":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/comments?post=228"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/228\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/229"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}