The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to recover a deleted account

Discussion in 'Data Protection' started by paulg, Sep 3, 2009.

  1. paulg

    paulg Member
    PartnerNOC

    Joined:
    Dec 16, 2008
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Hello,
    I need to restore/recover an account that was accidentally deleted/terminated. I don't have a cpmove tarball to restore from; all I have are backups (R1Soft) of the data. Can someone give me a list of all the files/directories that I need to restore so everything works again (ie DNS, MySQL, Cron jobs, additional domains, subdomains, etc)? I'm very grateful.
    Thanks,
    Paul
     
  2. WebScHoLaR

    WebScHoLaR Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    511
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Planet Earth
    First create a fresh account with the same username and domain name from the server so that entries will be added to required files. Here are the directories that you need to restore the following with OVERRIDE option checked in R1soft:

    /home/username
    /var/cpanel/users/username
    /var/cpanel/userdata/username
    /var/lib/mysql/username* (Restore the databases)

    DNS zone files need to be restored too from /var/named/ but the entry in /etc/named.conf need to be added again or you can just add new dns entries/zones.

    Once you restore all these, you may need to correct ownership and rebuild files:

    chown -Rvh useranme.username username
    chgrp -v nobody /home/username/public_html
    chgrp -v mail etc mail
    /scripts/updateuserdomains
    /usr/local/cpanel/bin/build_apache_conf
    /scripts/restartsrv httpd
     
  3. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    We have the cpanel hook script /scripts/prekillacct created, which does a backup of the account just before deleting it.

    That way, if you delete an account accidentally, you still have a copy of the account which you can restore.
     
  4. paulg

    paulg Member
    PartnerNOC

    Joined:
    Dec 16, 2008
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Thank you both. Your comments were very helpful.
     
  5. paulg

    paulg Member
    PartnerNOC

    Joined:
    Dec 16, 2008
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    For future reference, add /var/spool/cron/username to the list of files that need to be restored. This file will only exist if the user has created cron jobs.
     
Loading...

Share This Page