get owner username from command line using domain name
Is there a way for me to type a domain/subdomain/addon domain/parked domain in ssh and it tells me the username of the account it belongs to?
For example, if I typed this..
It would return something like this...
Then I would be able to make another query which allows me to make changes to /home/joebloogs The issue I have is that I have a really nice bash script for something else, but I have to know the username first before I can execute it and the only ay to do it is to open WHM " Home "Account Information "List Subdomains ,t hen do CTRL + F to find the domain and see who owns it. So would make my life easier if I could just type the domain name in the script and then execute what I need.
# /root/querydomain.sh some_add_on_domain-comIt would return something like this...
# owner username for some_add_on_domain-com is: joebloggsThen I would be able to make another query which allows me to make changes to /home/joebloogs The issue I have is that I have a really nice bash script for something else, but I have to know the username first before I can execute it and the only ay to do it is to open WHM " Home "Account Information "List Subdomains ,t hen do CTRL + F to find the domain and see who owns it. So would make my life easier if I could just type the domain name in the script and then execute what I need.
-
You could just do a locate domain.com which would give you a few locations one of which would be /home/username/domain.com locate domain.com0 -
[quote="kernow, post: 1486852">You could just do a locate domain.com which would give you a few locations one of which would be /home/username/domain.com locate domain.com
cool. that gives ALOT of paths. ALL i need to do now is parse them and I will be able to get the owner username. Thanks!0 -
How about: [QUOTE] grep "somedomain.com" /var/cpanel/users/* 0 -
Even simpler : /scripts/whoowns yourdomain.com 0 -
[quote="yapluka, post: 1486912">Even simpler : /scripts/whoowns yourdomain.com
I wonder if there is a complete list of those scripts, this obviously is not: [url=http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/WHMScripts]WHM Scripts0 -
"cat /etc/domainusers|grep domain.com" should work. 0 -
Hello :) Yes, the following script should work for you: /scripts/whoowns $domain
You could also search for the domain name in the /etc/userdomains file. EX:grep $domain /etc/userdomains
Thank you.0 -
[quote="cPanelMichael, post: 1487291"> Yes, the following script should work for you: /scripts/whoowns $domain
You could also search for the domain name in the /etc/userdomains file. EX:grep $domain /etc/userdomains
Thank you.
Those work perfect thanks!0
Please sign in to leave a comment.
Comments
8 comments