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 terminate all reseller's accounts but leave DNS on server?

Discussion in 'Bind / DNS / Nameserver Issues' started by electric, Mar 2, 2012.

  1. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    697
    Likes Received:
    1
    Trophy Points:
    18
    Hello,

    We have moved one of our reseller's to a different server within the DNS cluster that we have set up.

    How can we terminate all their accounts on the old server, but leave the DNS in place?

    ie: We do not want to kill the zonefiles along with the accounts, since I think that would also remove the DNS from the DNS cluster... causing their sites on the new server to go down since now there would be no DNS.

    In other words, how do we terminate all the resellers accounts, but "Keep Dns Zone (needed if you have moved a domain between servers in the same dns trust relationship, and wish to remove the old domain)".

    This option is not available in the reseller termination screen in WHM.
     
  2. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    697
    Likes Received:
    1
    Trophy Points:
    18
    BTW - this reseller has over 400 accounts. So manually selecting them one-by-one on the "Terminate Multiple Accounts" screen (along with the checkbox to keep DNS) doesn't seem like a good idea.

    Thanks.
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    All right, first grab a list of all the accounts and put that list into a file called /root/acctlist:

    Code:
    grep -v 'root\|#' /etc/trueuserowners | grep resellerusername | cut -d: -f1 > /root/acctlist
    Please replace resellerusername with the reseller's username. For example, here's what I get on my machine when I run this where the users are the accounts under my endar reseller:

    Code:
    root@host [/]# grep -v 'root\|#' /etc/trueuserowners | grep endar | cut -d: -f1 > /root/acctlist
    root@host [/]# cat /root/acctlist
    ratings
    endar
    Now that you have a list of users, you can run the following to loop through that list to terminate the accounts but still keep the DNS:

    Code:
    for i in `cat /root/acctlist` ;do /usr/local/cpanel/scripts/killacct $i --killdns=n --force ;done
    This is a very powerful command as it will remove the accounts entirely without any prompt to ask if you want to do so due to the --force portion. Please only use this if you are absolutely positive that a) you have backups available if anything goes wrong for all accounts, b) the list of accounts in /root/acctlist is the correct list of accounts owned by that reseller.

    Thanks!
     

Share This Page