Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

get owner username from command line using domain name

Discussion in 'General Discussion' started by craigedmonds, Oct 20, 2013.

  1. craigedmonds

    craigedmonds Well-Known Member

    Joined:
    Oct 29, 2007
    Messages:
    112
    Likes Received:
    0
    Trophy Points:
    66
    Location:
    Europe
    cPanel Access Level:
    Root Administrator
    Twitter:
    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..

    Code:
    # /root/querydomain.sh some_add_on_domain-com
    It would return something like this...

    Code:
    # owner username for some_add_on_domain-com is: joebloggs
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    920
    Likes Received:
    13
    Trophy Points:
    168
    cPanel Access Level:
    Root Administrator
    You could just do a locate domain.com which would give you a few locations one of which would be /home/username/domain.com
    Code:
    locate domain.com
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. craigedmonds

    craigedmonds Well-Known Member

    Joined:
    Oct 29, 2007
    Messages:
    112
    Likes Received:
    0
    Trophy Points:
    66
    Location:
    Europe
    cPanel Access Level:
    Root Administrator
    Twitter:
    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!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #3 craigedmonds, Oct 20, 2013
    Last edited: Oct 20, 2013
  4. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    11
    Trophy Points:
    168
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    How about:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    France
    cPanel Access Level:
    Root Administrator
    Even simpler :

    /scripts/whoowns yourdomain.com
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    11
    Trophy Points:
    168
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    I wonder if there is a complete list of those scripts, this obviously is not:
    WHM Scripts
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Sys Admin

    Sys Admin Well-Known Member

    Joined:
    Apr 29, 2007
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    156
    cPanel Access Level:
    Root Administrator
    "cat /etc/domainusers|grep domain.com" should work.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,895
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Yes, the following script should work for you:

    Code:
    /scripts/whoowns $domain
    You could also search for the domain name in the /etc/userdomains file. EX:

    Code:
    grep $domain /etc/userdomains
    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. craigedmonds

    craigedmonds Well-Known Member

    Joined:
    Oct 29, 2007
    Messages:
    112
    Likes Received:
    0
    Trophy Points:
    66
    Location:
    Europe
    cPanel Access Level:
    Root Administrator
    Twitter:
    Those work perfect thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice