This tutorial includes methods to help you identify abandoned or inactive cPanel accounts.
• We strongly recommend that you create backups for cPanel accounts you deem as abandoned before terminating the account. You can use the /usr/local/cpanel/scripts/pkgacct script to create a backup for an account. For more information, read our Pkgacct documentation.
• The instructions in this tutorial do not encompass every use-case, and therefore, prudent inspection of an account's activity is recommended before termination.
• SSH access and root-level privileges are required to execute the commands included in this tutorial.
1. Find cPanel accounts with primary domains that do not resolve to the cPanel & WHM server.
A domain that resolves to another server's IP address (or does not resolve at all) is one indicator of an abandoned account. The following command will output a list of domains that do not resolve to their cPanel account's assigned IP address:
• This command performs a DNS check on each cPanel account's primary domain and then compares the domain's publicly served A record against the IP address assigned to the cPanel account. The command does not perform a DNS check on Addon Domains, Aliases, or Subdomains.
• It's not uncommon to see cPanel accounts with domains used exclusively for specific services such as Email. In these cases, it's possible for the cPanel account to remain active even if the primary domain resolves to a remote server. This command checks if the MX record resolves to the cPanel & WHM server and outputs a warning for those domains.
• Domains using third-party services such as CloudFlare will show up in the output of this command.
2. Check the AutoSSL Logs.
cPanel & WHM's AutoSSL feature performs a check similar to the command shared under the first step in this tutorial during the Domain Control Validation process. You can browse to the Logs tab in WHM >> Manager AutoSSL to look for the following error message in the All Users log output:
This specific error message, while not entirely definitive, does warrant further scrutiny into the accounts status for an administrative determination on removal.
3. Find recent cPanel login sessions.
The following command will search /usr/local/cpanel/logs/session_log and output the last three dates upon which the cPanel account was accessed:
Ensure you replace $USERNAME with the username of the cPanel account to search.
To search the recent cPanel session activity for all cPanel users on the server, execute the following command:
• This command does not differentiate between sessions created by direct cPanel logins and sessions generated from root or reseller users that access cPanel for the account directly from WHM (or with the root/reseller password).
4. Find recent email login activity.
The following command will check all email accounts on the server and output any email account (and it's cPanel username) with zero logins in the past 60 days:
• This command may take several minutes to complete on servers with high numbers of email accounts.
• You can replace "60" with your preferred number of days. Keep in mind that this command is only scanning the entries present in /var/log/maillog*.
Feel free to click on the Discussion tab to let us know if you have any questions or feedback about the information in this tutorial.
Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!