How to get a list of total cPanel users under a specific re-seller via command line – WHM/cPanel server

Do you wish to list all cPanel accounts under a specific reseller?

If so, it’s very simple to list all cPanel users’ name via command line interface (CLI). There is a file ‘/etc/trueuserowners‘ in your WHM server which has all cPanel username and it’s owner’s name details. We can simply grep out our requirement from this file 🙂

File which has user:owner details is:

/etc/trueuserowners

List all users under a reseller account

Please do follow the steps pasted below to list out all cPanel accounts a particular reseller account:

Step 1 : SSH to server as root user.

Step 2 : You can use the grep and cut command to list all users’ name from /etc/trueuserowners file.

Syntax

# grep $Re-seller's-name /etc/trueuserowners | cut -d : -f 1

$Re-seller’s : replace it with the re-seller acount name

Example

# grep crybit /etc/trueuserowners | cut -d : -f 1
tieuwn
sinwe8
crybit
dewan

That’s it 🙂

## Update  ##

Is there any command to sort-out Resellers who created more cPanel accounts?

You can use the following command to list/sort reseller accounts with high cPanel accounts. Please do follow the steps pasted below:

Step 1 : SSH to server as root user.

Step 2 : Copy all reseller accounts name to a file.

grep -o '^[a-z][a-z0-9]\{0,7\}' /var/cpanel/resellers > resellers.txt

Step 3 : Execute the “for” loop to sort out reseller accounts with its cPanel count.

for i in `cat reseller.txt`; do grep $i /etc/trueuserowners|cut -d : -f 2;done |sort|uniq -c|sort -nr|less

That’s it!!

Related:
check the version of your WHM/cPanel from command line
Important cPanel service’s configuration file, path, service name, port – Command line view
How to terminate/delete a cPanel account through SSH

Something more about cPanel  , See the category CPANEL

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

4 Responses

  1. Vishal says:

    Is there any command to check Top 10 Resellers who created more cPanel accounts ?

  2. Hello,

    You can use below command to get top 10 reseller who create more cPanel users.

    for i in `cat resellers.txt`; do grep $i /etc/trueuserowners|cut -d : -f 2;done |sort|uniq -c|sort -rn | head

Leave a Reply

Your email address will not be published. Required fields are marked *