How to rebuild user data files from a valid httpd.conf file

In some situation your server’s userdata files (/var/cpanel/userdata/ directory comprises for each account) may get corrupted or can be entirely missing.

Below are the Steps that explain to rebuild userdata files with a valid httpd.conf file

1. The userdata directory that has been corrupted must be moved to a new location.

You can do this by using the mv command to move the directory and its contents to a new location.
mv /var/cpanel/userdata /var/cpanel/userdata.orig

rebuild-1

2. A new userdata directory must be created.

To create new user data directory use mkdir command
mkdir /var/cpanel/userdata

rebuild-2

3. To rebuild userdata files run userdata_update script

The /usr/local/cpanel/bin/userdata_update script restores userdata files for all of the accounts that are present on your server.
/usr/local/cpanel/bin/userdata_update –reset

rebuild-3

4. To validate the userdata permissions settings run the script fix_userdata_perms

The /usr/local/cpanel/bin/fix_userdata_perms script makes certain that all of your server’s userdata files and directories are assigned the correct permissions settings.
/usr/local/cpanel/bin/fix_userdata_perms

rebuild-4

5. To update the system’s cache run script updateuserdatacache.

The /scripts/updateuserdatacache script makes sure that the system appropriately caches all userdata files.
/scripts/updateuserdatacache

rebuild-5

6. Restore Apache.

To use the rebuilt userdata files, you must rebuild Apache.
/scripts/rebuildhttpdconf

rebuild-6

7. Apache Restart is required

Restart Apache on your server after you rebuild it.
/scripts/restartsrv_httpd

rebuild-7