How to terminate all reseller's accounts but leave DNS on server? Print

  • 0

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

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:

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:

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.
 

Was this answer helpful?

« Back