title: How to Rebuild userdata Files created at: Wed Oct 30 2024 06:54:10 GMT+0000 (Coordinated Universal Time) updated at: Sat Feb 08 2025 14:22:50 GMT+0000 (Coordinated Universal Time) --- # How to Rebuild userdata Files # Overview !! Warning: !! Do **not** perform the steps in this document unless you are **certain** that your server’s `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’s `userdata` files (the files that the `/var/cpanel/userdata/` 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. The method that you use depends on whether a valid `httpd.conf` file exists on your server: * If a valid `httpd.conf` file exists, follow the [Rebuild userdata files with a valid httpd.conf file](https://docs.cpanel.net/knowledge-base/accounts/how-to-rebuild-userdata-files/#validfile) steps below. * If a valid `httpd.conf` file **does not** exist, follow the [Rebuild userdata files from a recent backup](https://docs.cpanel.net/knowledge-base/accounts/how-to-rebuild-userdata-files/#rebuild-from-a-recent-backup) steps below. !! Note: !! The steps below assume that you have already logged in to your server via SSH as the `root` user. # Rebuild userdata files ## Rebuild from a valid file !! Warning: !! These steps **require** that a valid `httpd.conf` file exists on your server. If one does not exist, rebuild userdata files [from a recent backup](https://docs.cpanel.net/knowledge-base/accounts/how-to-rebuild-userdata-files/#rebuild-from-a-recent-backup) instead. Move the corrupt userdata directory to a new location. If a `userdata` directory currently exists on your server, use the `mv` command to move it and its contents to a new location. To do this, run the following command: ```javascript mv /var/cpanel/userdata /var/cpanel/userdata.orig ``` Create a new userdata directory. Use the `mkdir` command to create a new `userdata` directory. To do this, run the following command: ```javascript mkdir /var/cpanel/userdata ``` Run the userdata\_update script to rebuild userdata files for all of your accounts. The `/usr/local/cpanel/bin/userdata_update` script rebuilds `userdata` files for all of the accounts that exist on your server. !! Warning: !! The `--reset` flag regenerates files and directories within the `userdata` directory. To do this, it uses data from the current Apache configuration file. !! It does **not** conserve existing `userdata` files. **Only** use it as a last resort. !! If you run the `userdata_update` script with the `--reset` flag, and you have not already copied any existing data, the system **will** overwrite the existing `userdata` files and directories. !! This flag **requires** that a valid `httpd.conf` file exists on your server. If one does not exist, you **must** restore your userdata files from your most recent backup. To do this, run the following command: ```bash /usr/local/cpanel/bin/userdata_update --reset ``` !! Note: !! Run the `/usr/local/cpanel/bin/userdata_update` script with the `--unpark-addons` flag to fix problems in which the system lists an addon domain as a parked domain (alias). This flag resets all of your server’s userdata files. Run the fix\_userdata\_perms script to validate the userdata permissions settings. The `/usr/local/cpanel/bin/fix_userdata_perms` script ensures that all of your server’s `userdata` files and directories use the correct permissions settings. To do this, run the following command: ```javascript /usr/local/cpanel/bin/fix_userdata_perms ``` Run the updateuserdatacache script to update the system's cache. The `/scripts/updateuserdatacache` script ensures that the system properly caches all `userdata` files. To do this, run the following command: ```bash /scripts/updateuserdatacache ``` Rebuild Apache. You **must** rebuild Apache to use the rebuilt userdata files. To do this, run the following command: ```bash /scripts/rebuildhttpdconf ``` Restart Apache. After you rebuild Apache, you **must** restart it on your server. To do this, run the following command: ```bash /scripts/restartsrv_httpd ``` ## Rebuild from a recent backup !! Warning: !! These steps rebuild userdata files from a recent backup. If a valid `httpd.conf` file exists on your server, we **strongly** recommend that you rebuild from this file instead. Copy the corrupt userdata directory to a new location. If a `userdata` directory currently exists on your server, copy it and its contents to the `cpanel` directory. To do this, run the following command: ```bash cp -rfp /var/cpanel/userdata /var/cpanel ``` Create and navigate to a new directory in the root directory. Create a new directory within the `root` directory and navigate to it. To do this, run the following command, where `example` represents the name of the new directory: ```bash mkdir /root/example && cd /root/example ``` Extract the contents of your backup file to the new directory. The method that you use to extract the backup depends on the type of backup file. For example, if your backup file is a `.tar.gz` file, run the following command, where `backup.tar.gz` represents the absolute path to the backup file: ```bash tar -zxvf backup.tar.gz ``` Run the updateuserdatacache script to update the system's cache. The `/scripts/updateuserdatacache` script ensures that the system properly caches all userdata files. To do this, run the following command: ```bash /scripts/updateuserdatacache ``` Rebuild Apache. You **must** rebuild Apache to use the rebuilt `userdata` files. To do this, run the following command: ```bash /scripts/rebuildhttpdconf ``` Restart Apache. After you rebuild Apache, you **must** restart it on your server. To do this, run the following command: ```javascript /scripts/restartsrv_httpd ```