How to rebuilt corrupted userdata files in cPanel

269ac00f765508cb74b25d006dbf5bb2

Written by Dennis Nind

Last published at: August 1st, 2019

In certain circumstances, your servers user data files may corrupt which can create issues while migrating, operating the cpanel accounts. These user data files can be repaired using a valid and working httpd.conf file on the server.

Let's assume we have a corrupted user data file, in order to rebuild the user data file follow the steps as below.

  1. Login to your WHM/Cpanel server with root user

  2. The user data files are located at /var/cpanel. Make sure if the userdata directory is present on the server.

  3. If the directory exists , move it or rename it with mv command

    mv /var/cpanel/userdata /var/cpanel/userdata_backup


  1. Create a new user data directory with the command mkdir

    mkdir /var/cpanel/userdata



  2. Now that we have a new userdata directory created , in order to rebuild userdata files for all the accounts hosted on your cpanel server run the script “userdata_update” with “--reset” flag which will rebuild the userdata files for all the accounts that are hosted on your cpanel server.

    /usr/local/cpanel/bin/userdata_update –reset

       

  1. The next step will be to fix the permissions for newly generated user data files which can be done by running the command

    /usr/local/cpanel/bin/fix_userdata_perms




  1. Since we have a new userdata file generated we will need to update the system’s cache which can be done by command

    /scripts/updateuserdatacache

  2. Now rebuild the apache configuration in order to use the newly rebuilt userdata files with the command

    /scripts/rebuildhttpdconf