Occasionally, it may be required that you will need to remove a full reseller from a cPanel server. This can be done via the WHM interfaces, however can be more convenient through the command line.

Run in the foreground

To do this, we generally use the following script…

for user in $(grep reseller_user_name /etc/trueuserowners | awk -F":" '{print $1}'); do /scripts/removeacct $user --force --keepdns; done;

Of course, replacing the ‘reseller_user_name’ value with the actual resellers username.

Additional Flags

In the example above, we have added…

–force – This will avoid the ‘prompt’, which required you to confirm each account removal and will instead just force the termination of each account

–keepdns – We add this flag because we are using a ‘DNS Cluster’. As such, removal of the account DNS will also feed back to the DNS clusters themselves. This is fine, if the client / reseller has ‘moved’ elsewhere and the account is no longer required, however it may be the case that the reseller has simply been moved to a new machine. In this case, the DNS will need to remain intact.

Run via the WHMAPI

whmapi1 terminatereseller user=username terminatereseller=1

Did this answer your question?