Skip to Content

linux spy

Linux CPanel Web-hosting Blog

  • Home
  • About
  • Contact us
Home / Cpanel Issues, Scripts / Shell script to list all cpanel accounts for specific reseller

Shell script to list all cpanel accounts for specific reseller

By Raj on December 12, 2011

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

 

 #!/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

Copy the above script in a .sh file like listreseller.sh and allow executable permission to listreseller.sh file and then execute it as :

 

root@server[#] ./listreseller resellerusername

or

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

 

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

 

root@server[#] ./listreseller test.com
 ==========================================================
 Below are the accounts associated with the reseller
 ==========================================================
 test
 raj
 sunil

or

 

 root@server[#] ./listreseller newtest
 newtest is not a reseller

That’s all.

This entry is filed under Cpanel Issues, Scripts and tagged How to get list of cpanel accounts for specific reseller?, List all cPanel accounts under a reseller, List out the users under a reseller account in cPanel Servers, Shell script to list all cpanel accounts for specific reseller.

Comments are closed.

« Command to check perl modules installed on the server
Nameserver IP’s Missing in WHM? »

Categories

  • .HTACCESS
  • Cpanel Issues
  • Email Issues
  • FTP ISSUES
  • Installations
  • MYSQL
  • PHP
  • Plesk
  • Ruby On Rails
  • Scripts
  • Tomcat
  • Uncategorized
  • Virtualbox
  • Windows

Archives

Recent Posts

  • Raid Monitoring Insatallation and Configuration
  • Table ‘mybb_datacache’ is marked as crashed
  • File size limit exceeded (core dumped)
  • Problem installing PECL UploadProgress
  • Softaculous error The MySQL Database could not be selected.

Tag Cloud

421 Sorry cleartext sessions are not accepted on this server CSF Firewall Installation Disable the server signature using .htaccess Entropy Search ERROR : * JFTP::login: Bad Password * JFTP::_passive: Unable to obtain IP and port for data transfer Error : Premature end of script headers: php: Please check /usr /local /cpanel /logs /error_log for the exact error. Error Deleting FTP account or not able to delete FTP account. Error from park wrapper: domain.com is owned by another user. How to change timezone on Linux server How to Create Tomcat Service Daemon in CPanel Server How to delete or disable Anonymous FTP account Access. How to disable website pages download using wget ? How to enable .zip file import in PHPMyAdmin How to enable PHP settings for all Directories How to enable Tomcat for addon domain. How to Enable Tomcat Support for Temporary URL How to Find Java and Tomcat Version on Server How to find MySql Version How to redirect a Domain to sub-directories ? How to remove the .html extension from the URL ? How to remove the .php extension from the URLS ? How to Restart Ruby On Rails for a particular Web Application How to Uninstall CSF Firewall How to update the yum repository on Centos 5 server Invalid maildirsize file! lowest numbered MX record points to local host. Mailman error “Bug in Mailman version 2.1.11.cp3? MYSQL COMMANDS Mysql Connection Settings in JSP Mysql Database size showing '0' in cPanel Outlook Error Number: 0×800CCC67 Outlook Settings. Ownership wrong for cPanel users Redirection from http to https Redirection from one page to another using .htaccess Reset the MySQL root password on Ubuntu Rouncube hangs while sending message Roundcube SMTP error Roundcube Throwing SMTP error Set the server administrator email using .htaccess Set the Server Timezone using .htaccess Template Error: The template file must be given View Stats outside Cpanel or without login to Cpanel. Warning: file() [function.file]: URL file-access is disabled in the server configuration Webmail Shows Internal Server Error User is Over Quota.

.HTACCESS (21)
Cpanel Issues (35)
Email Issues (18)
FTP ISSUES (5)
Installations (3)
MYSQL (8)
PHP (18)
Plesk (21)
Ruby On Rails (1)
Scripts (2)
Tomcat (8)
Uncategorized (33)
Virtualbox (1)
Windows (2)

WP-Cumulus by Roy Tanck and Luke Morton requires Flash Player 9 or better.


221
Unique
Visitors
Powered By Google Analytics

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Blogroll

  • Best Designs
  • indianwebportal.com
  • Plugins
  • Support Forum
  • Themes
  • WordPress Planet

Copyright © 2012 linux spy | Powered by linuxspy