{"id":203,"date":"2021-07-23T12:19:15","date_gmt":"2021-07-23T12:19:15","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/how-to-rebuild-userdata-files\/"},"modified":"2021-07-23T12:19:15","modified_gmt":"2021-07-23T12:19:15","slug":"how-to-rebuild-userdata-files","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/how-to-rebuild-userdata-files\/","title":{"rendered":"How to Rebuild userdata Files"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\"><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<p>Do <strong>not<\/strong> perform the steps in this document unless you are <strong>certain<\/strong> that your server\u2019s <code>userdata<\/code> files are corrupt or do not exist. You should <strong>only<\/strong> perform these steps when no other method will resolve the issue.<\/p>\n<\/p><\/div>\n<\/div>\n<p>In certain circumstances, your server\u2019s <code>userdata<\/code> files (the files that the <code>\/var\/cpanel\/userdata\/<\/code> directory contains for each account) may become corrupt, or may not exist. If this occurs, use the methods in this document to attempt to rebuild these files.<\/p>\n<p>The method that you use depends on whether a valid <code>httpd.conf<\/code> file exists on your server:<\/p>\n<ul>\n<li>If a valid <code>httpd.conf<\/code> file exists, follow the Rebuild userdata files with a valid httpd.conf file steps below.<\/li>\n<li>If a valid <code>httpd.conf<\/code> file <strong>does not<\/strong> exist, follow the Rebuild userdata files from a recent backup steps below.<\/li>\n<\/ul>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>The steps below assume that you have already logged in to your server via SSH as the <code>root<\/code> user.<\/p>\n<\/p><\/div>\n<\/div>\n<h2 id=\"rebuild-userdata-files\">Rebuild userdata files<\/h2>\n<h3 id=\"validfile\">Rebuild from a valid file<\/h3>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<p>These steps <strong>require<\/strong> that a valid <code>httpd.conf<\/code> file exists on your server. If one does not exist, rebuild userdata files from a recent backup instead.<\/p>\n<\/p><\/div>\n<\/div>\n<div class=\"accordion-wrapper\">\n<div class=\"accordion-item\">\n<p>        Move the corrupt userdata directory to a new location.<\/p>\n<div class=\"collapse\" id=\"move-the-corrupt-userdata-directory-to-a-new-location-1626990176528986066\">\n<div class=\"card card-body\">\n<p>If a <code>userdata<\/code> directory currently exists on your server, use the <code>mv<\/code> command to move it and its contents to a new location.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\">mv <span style=\"color:#e6db74\">\/var\/c<\/span>panel<span style=\"color:#e6db74\">\/userdata \/<\/span>var<span style=\"color:#e6db74\">\/cpanel\/<\/span>userdata<span style=\"color:#f92672\">.<\/span>orig<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Create a new userdata directory.<\/p>\n<div class=\"collapse\" id=\"create-a-new-userdata-directory-1626990176529699177\">\n<div class=\"card card-body\">\n<p>Use the <code>mkdir<\/code> command to create a new userdata directory.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\">mkdir <span style=\"color:#e6db74\">\/var\/c<\/span>panel<span style=\"color:#f92672\">\/<\/span>userdata<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Run the userdata_update script to rebuild userdata files for all of your accounts.<\/p>\n<div class=\"collapse\" id=\"run-the-userdata_update-script-to-rebuild-userdata-files-for-all-of-your-accounts-1626990176530679460\">\n<div class=\"card card-body\">\n<p>The <code>\/usr\/local\/cpanel\/bin\/userdata_update<\/code> script rebuilds <code>userdata<\/code> files for all of the accounts that exist on your server.<\/p>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<p>The <code>--reset<\/code> flag regenerates files and directories within the <code>userdata<\/code> directory. To do this, it uses data from the current Apache configuration file.<\/p>\n<ul>\n<li>It does <strong>not<\/strong> conserve existing <code>userdata<\/code> files. <strong>Only<\/strong> use it as a last resort.<\/li>\n<li>If you run the <code>userdata_update<\/code> script with the <code>--reset<\/code> flag, and you have not already copied any existing data, the system <strong>will<\/strong> overwrite the existing <code>userdata<\/code> files and directories.<\/li>\n<li>This flag <strong>requires<\/strong> that a valid <code>httpd.conf<\/code> file exists on your server. If one does not exist, you <strong>must<\/strong> restore your userdata files from your most recent backup.<\/li>\n<\/ul><\/div>\n<\/div>\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-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/usr\/<\/span>local<span style=\"color:#e6db74\">\/cpanel\/<\/span>bin<span style=\"color:#f92672\">\/<\/span>userdata_update <span style=\"color:#f92672\">--<\/span><span style=\"color:#66d9ef\">reset<\/span><\/code><\/pre>\n<\/div>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>Run the <code>\/usr\/local\/cpanel\/bin\/userdata_update<\/code> script with the <code>--unpark-addons<\/code> flag to fix problems in which the system lists an addon domain as a parked domain (alias). This flag resets all of your server\u2019s userdata files.<\/p>\n<\/p><\/div>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Run the fix_userdata_perms script to validate the userdata permissions settings.<\/p>\n<div class=\"collapse\" id=\"run-the-fix_userdata_perms-script-to-validate-the-userdata-permissions-settings-1626990176531436075\">\n<div class=\"card card-body\">\n<p>The <code>\/usr\/local\/cpanel\/bin\/fix_userdata_perms<\/code> script ensures that all of your server\u2019s <code>userdata<\/code> files and directories use the correct permissions settings.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/usr\/<\/span>local<span style=\"color:#e6db74\">\/cpanel\/<\/span>bin<span style=\"color:#f92672\">\/<\/span>fix_userdata_perms<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Run the updateuserdatacache script to update the system&#8217;s cache.<\/p>\n<div class=\"collapse\" id=\"run-the-updateuserdatacache-script-to-update-the-systems-cache-1626990176532048150\">\n<div class=\"card card-body\">\n<p>The <code>\/scripts\/updateuserdatacache<\/code> script ensures that the system properly caches all <code>userdata<\/code> files.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/scripts\/<\/span>updateuserdatacache<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Rebuild Apache.<\/p>\n<div class=\"collapse\" id=\"rebuild-apache-1626990176532660687\">\n<div class=\"card card-body\">\n<p>You <strong>must<\/strong> rebuild Apache to use the rebuilt userdata files.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/scripts\/<\/span>rebuildhttpdconf<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Restart Apache.<\/p>\n<div class=\"collapse\" id=\"restart-apache-1626990176533282674\">\n<div class=\"card card-body\">\n<p>After you rebuild Apache, you <strong>must<\/strong> restart it on your server.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/scripts\/<\/span>restartsrv_httpd<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<\/div>\n<h3 id=\"rebuild-from-a-recent-backup\">Rebuild from a recent backup<\/h3>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<p>These steps rebuild userdata files from a recent backup. If a valid <code>httpd.conf<\/code> file exists on your server, we <strong>strongly<\/strong> recommend that you rebuild from this file instead.<\/p>\n<\/p><\/div>\n<\/div>\n<div class=\"accordion-wrapper\">\n<div class=\"accordion-item\">\n<p>        Copy the corrupt userdata directory to a new location.<\/p>\n<div class=\"collapse\" id=\"copy-the-corrupt-userdata-directory-to-a-new-location-1626990176534721913\">\n<div class=\"card card-body\">\n<p>If a <code>userdata<\/code> directory currently exists on your server, copy it and its contents to the <code>cpanel<\/code> directory.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\">cp <span style=\"color:#f92672\">-<\/span>rfp <span style=\"color:#e6db74\">\/var\/c<\/span>panel<span style=\"color:#e6db74\">\/userdata \/<\/span>var<span style=\"color:#f92672\">\/<\/span>cpanel<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Create and navigate to a new directory in the root directory.<\/p>\n<div class=\"collapse\" id=\"create-and-navigate-to-a-new-directory-in-the-root-directory-1626990176536148878\">\n<div class=\"card card-body\">\n<p>Create a new directory within the <code>root<\/code> directory and navigate to it.<\/p>\n<p>To do this, run the following command, where <code>example<\/code> represents the name of the new directory:\n<\/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-perl\" data-lang=\"perl\">mkdir <span style=\"color:#e6db74\">\/root\/<\/span>example <span style=\"color:#f92672\">&&<\/span> cd <span style=\"color:#e6db74\">\/root\/<\/span>example<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Extract the contents of your backup file to the new directory.<\/p>\n<div class=\"collapse\" id=\"extract-the-contents-of-your-backup-file-to-the-new-directory-1626990176537628894\">\n<div class=\"card card-body\">\n<p>The method that you use to extract the backup depends on the type of backup file.<\/p>\n<p>For example, if your backup file is a <code>.tar.gz<\/code> file, run the following command, where <code>backup.tar.gz<\/code> represents the absolute path to the backup file:\n<\/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-perl\" data-lang=\"perl\">tar <span style=\"color:#f92672\">-<\/span>zxvf backup<span style=\"color:#f92672\">.<\/span>tar<span style=\"color:#f92672\">.<\/span>gz<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Run the updateuserdatacache script to update the system&#8217;s cache.<\/p>\n<div class=\"collapse\" id=\"run-the-updateuserdatacache-script-to-update-the-systems-cache-1626990176538693878\">\n<div class=\"card card-body\">\n<p>The <code>\/scripts\/updateuserdatacache<\/code> script ensures that the system properly caches all userdata files.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/scripts\/<\/span>updateuserdatacache<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Rebuild Apache.<\/p>\n<div class=\"collapse\" id=\"rebuild-apache-1626990176539715018\">\n<div class=\"card card-body\">\n<p>You <strong>must<\/strong> rebuild Apache to use the rebuilt <code>userdata<\/code> files.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/scripts\/<\/span>rebuildhttpdconf<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<div class=\"accordion-item\">\n<p>        Restart Apache.<\/p>\n<div class=\"collapse\" id=\"restart-apache-1626990176540741874\">\n<div class=\"card card-body\">\n<p>After you rebuild Apache, you <strong>must<\/strong> restart it on your server.<\/p>\n<p>To do this, run the following command:\n<\/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-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/scripts\/<\/span>restartsrv_httpd<\/code><\/pre>\n<\/div><\/div>\n<p>\n    <\/div>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Overview Warning: Do not perform the steps in this document unless you are certain that your server\u2019s userdata files are corrupt or do not exist. You should only perform these steps when no other method will resolve the issue. In certain circumstances, your server\u2019s userdata files (the files that the \/var\/cpanel\/userdata\/ directory contains for each &hellip;<\/p>\n","protected":false},"author":1,"featured_media":204,"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\/203"}],"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=203"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/204"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}