cPanel

Find out the reseller name with domains

How to find out the reseller name with domains?

Ans :

If you want to list all cPanel accounts under a specific reseller, then you can use the below simple shell script.

1) Crete the file reseller.sh and add the following code.

vi /home/reseller.sh
==========================================================
#!/bin/bash
usage()
{
echo "Example : $0 domain.com or username"
exit 1
}

test $1 || usage
USERN=$(grep $1 "/etc/userdomains" | awk '{print $NF}' | awk 'NR==1')

if [[ -z $USERN ]]
then
echo -e "\e[1;33m $1 is not a reseller \e[0m"

exit 1
fi

OWNER=`cut -d: -f1 /var/cpanel/resellers | grep -o $USERN`
exitstatus=$?

if [ "$exitstatus" == 0 ] ; then
echo "=========================================================="
echo -e "\e[1;31m Below are the accounts associated with the reseller $name \e[0m"
echo "=========================================================="

output=$(for i in `grep $OWNER /var/cpanel/users/* -l` ; do grep USER= $i ; done | awk -F"=" '{ print $2 }')
echo -e "\e[1;33m $output \e[0m"
else
echo -e "\e[1;35m $1 is not a Reseller \e[0m"
exit

fi

==========================================================
2) chmod 755 /home/reseller.sh

3) cd /home/

4)root@server[#] ./reseller resellerusername

or

root@server[#] ./reseller resellerdomain.com

After executing the script you will get the below output as ::

root@server[#] ./reseller indianwebportal.com

==========================================================
Below are the accounts associated with the reseller
==========================================================
test
raj
sunil
or

root@server[#] ./reseller newtest

newtest is not a reseller

That’s all.


Mayuresh Vaidya
Mayuresh Vaidya is an electronics and telecommunication engineer having an experience in embedded technology he worked on many technologies such as raspberry pi, Arduino, along IOT home automation devices based on Google and Alexa, also he had good interest in emerging technologies such as IOT, digital marketing, and web related technologies such as hacking and securities.

Recent Posts

The Ultimate Guide to WordPress Maintenance: Tips and Tricks

When you’re running a business that relies on website traffic and sales to succeed. Then you need to keep it…

1 week ago

Migrate In 2024: Our Comprehensive Website Migration Manual to the Next Level

Migration! Yes, this word is very big in the web hosting industry and it has its importance. Especially for businesses…

2 weeks ago

Unveiling the Importance of Server Maintenance Plans: A Comprehensive Guide

The server is the backbone of the web hosting industry and it acts like a HERO in the web hosting…

3 weeks ago

IP Address is Blocked? A handpicked list of Solutions to Fix it?

Imagine you are on holiday having a cup of tea and browsing your website or blog.Then, what next?You will get…

4 weeks ago

Explained: Difference between Nameservers Vs. DNS

The web hosting industry is growing every minute, day, and year. It has many terminologies that are important to understand…

1 month ago