How to rebuild corrupted userdata files in cPanel/WHM

cPanel uses userdata files to keep information about addon domains, parked domains, IPs, PHP versions used by accounts etc. If you came to the conclusion that the cPanel userdata files are corrupted, you can rebuild them. The process detailed below will be possible only if you have a valid httpd.conf file.

How to rebuild corrupted userdata files in cPanel/WHM

1. Log into your cPanel/WHM server with the root credentials

2. Move the existing userdata files to a new location. Use:

mv /var/cpanel/userdata /var/cpanel/userdata-original

3. Re-create the userdata directory with this command:

mkdir /var/cpanel/userdata

3. Run the cPanel utility that will generate the new userdata files. The command is:

/usr/local/cpanel/bin/userdata_update --reset

The –reset flag will regenerate the files from the httpd.conf file. This is the main command of the process. You can find out more about it by:

/usr/local/cpanel/bin/userdata_update --help
root@web [~]# /usr/local/cpanel/bin/userdata_update --help
Usage: userdata_update [--reset] [--unpark_addons] [--help | --usage]
Options:
--------------------------------
--reset
    IMPORTANT! Do not conserve existing userdata and regenerate new userdata files
    based upon the current Apache configuration file. This should be used as a last resort.

--unpark-addons
    Fix instances where an addon domain is also listed as a parked domain. This flag will
    result in a reset of all userdata files. See "--reset" warnings for more information.

--help
    Display usage information

root@web [~]#

4. Run the cPanel utility to verify that all the directories and files have the correct permissions set:

/usr/local/cpanel/bin/fix_userdata_perms

5. Run this cPanel script to update the system cache, as the new files and directories have just been generated

/scripts/updateuserdatacache

6. Apache must be rebuilt. Use the command:

/scripts/rebuildhttpdconf

7. Now Apache webserver must be restarted. This is the last step of the tutorial.

/scripts/restartsrv_httpd
cpanel userdata
cPanel userdata files for an account

Leave a Reply