Help - Search - Members - Calendar
Full Version: WHM/cPanel Manual Site Removal
The Planet Forums > Control Panels > cPanel/WHM
joec@home
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.
eth00
You may even want to mention removing it manually from the 2 DNS files (named.conf and the zone) as sometimes thatt does not like to work via WHM.
markcausa
Hmmm, I've never seen a site get corrupted before.

Is that common, John?
eth00
QUOTE(markcausa @ Aug 17 2008, 11:41 AM) *
Hmmm, I've never seen a site get corrupted before.

Is that common, John?


Yes relatively so, it comes up from time to time. Keep in mind we work with a lot more servers then you typically see which gives us a much larger sample size. The corruption seems to generally be related to bugs in cPanel. It is rare that it is anything serious, usually fixing it can be done in a minute if you are familiar with named configs.
joec@home
I know what you are saying about the main named conf file, but as the plan is to readd the corrupted account it ussually does not need to be removed there. Why it does not error I dont know, but never had an issue with it.


P.S.

I am flattered Eth0 noticed this. Over the years I leared a ton from their posts!
eth00
QUOTE(joec@home @ Aug 18 2008, 06:10 PM) *
I am flattered Eth0 noticed this. Over the years I leared a ton from their posts!


I don't post as much anymore but I do scan through stuff from time to time icon_smile.gif Good post overall!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.