Sometimes an account becomes corrupted, then what? Be it account creation or site migration some times some thing some where goes wrong and the account goes wacky. Some times you cant delete the account, some times it deletes but then you cannot re-add the account. The following is how to manually remove an account with out disturbing any databases. Unfortunately I have not found a method that will leave e-mail intact:
===== Manual Site Removal (Not completely tested) =====
In WHM
Remove zone for domain in DNS
In Shell
Remove user from /etc/passwd
Remove user from /etc/group
Remove user from /etc/group.lock
Make a backup of the web site data
If needed make a backup of the user e-mail
Remove the user account from the /home directory
Note: You intentionally DO NOT remove the MySQL databases in cPanel or shell, the intent is to keep the databases intact.
Replace the _account_name_ variable with the account name from WHM and run the following script:
for i in `ls -la /var/cpanel \
|grep -v drwx \
|grep -v lrwx \
| awk '{print $9}'`;\
do echo /var/cpanel/$i; \
cat /var/cpanel/$i \
|grep "_account_name_" ;\
done
From the files that the script outputs, edit the files removing all instances of the user name that was reported.
Remove user file in /var/cpanel/users/
Remove virtual domain listings from /etc/httpd/conf/httpd.conf
In WHM
Recreate the account
Reload the site and e-mail data, the databases should remain intact.
