The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    107
    Likes Received:
    0
    Trophy Points:
    16
    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.
     
  2. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    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
     
  3. craigedmonds

    craigedmonds Well-Known Member

    Joined:
    Oct 29, 2007
    Messages:
    107
    Likes Received:
    0
    Trophy Points:
    16
    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!
     
    #3 craigedmonds, Oct 20, 2013
    Last edited: Oct 20, 2013
  4. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    How about:
     
  5. yapluka

    yapluka Well-Known Member

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

    /scripts/whoowns yourdomain.com
     
  6. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    I wonder if there is a complete list of those scripts, this obviously is not:
    WHM Scripts
     
  7. Sys Admin

    Sys Admin Well-Known Member

    Joined:
    Apr 29, 2007
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    "cat /etc/domainusers|grep domain.com" should work.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  9. craigedmonds

    craigedmonds Well-Known Member

    Joined:
    Oct 29, 2007
    Messages:
    107
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Europe
    cPanel Access Level:
    Root Administrator
    Twitter:
    Those work perfect thanks!
     
Loading...

Share This Page