I'm sure you've all scratched your head a time or two when you need to find the username for 'xyz.com' on the server, right?
This easy shell script script solution. Login to root via SSH and do this:
pico /usr/local/bin/finddom
paste in this text (between the lines, NOT including the lines):
-----------------------------------------------------------------
#!/bin/sh
OUTPUT=`grep -r "$1" /etc/trueuserdomains`
if [ "$OUTPUT" != "" ]; then
OUTPUT2=`echo $OUTPUT | cut -d":" -f2`;
echo "";
echo "$1 is username: $OUTPUT2";
echo "";
else
echo " -- NO Match --";
fi
exit 0;
-----------------------------------------------------------------
Now, set permissions on it so you can run it:
chmod 700 /usr/local/bin/finddom
Now, next time you need to find xyz.com on the server, do this from SSH:
finddom xyz.com
or
finddom xyz
(or any unique part of the domain name) and it will quickly tell you the account username.
Cpanel is welcome to include this is any Cpanel build they want, possibly in the /scripts folder...
I use this at least 10 times a day, and hope it will help you too! Enjoy! :D
This easy shell script script solution. Login to root via SSH and do this:
pico /usr/local/bin/finddom
paste in this text (between the lines, NOT including the lines):
-----------------------------------------------------------------
#!/bin/sh
OUTPUT=`grep -r "$1" /etc/trueuserdomains`
if [ "$OUTPUT" != "" ]; then
OUTPUT2=`echo $OUTPUT | cut -d":" -f2`;
echo "";
echo "$1 is username: $OUTPUT2";
echo "";
else
echo " -- NO Match --";
fi
exit 0;
-----------------------------------------------------------------
Now, set permissions on it so you can run it:
chmod 700 /usr/local/bin/finddom
Now, next time you need to find xyz.com on the server, do this from SSH:
finddom xyz.com
or
finddom xyz
(or any unique part of the domain name) and it will quickly tell you the account username.
Cpanel is welcome to include this is any Cpanel build they want, possibly in the /scripts folder...
I use this at least 10 times a day, and hope it will help you too! Enjoy! :D