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!

Purpose of /etc/userdomains

Discussion in 'cPanel Developers' started by plesk4lyf, Jul 18, 2018.

  1. plesk4lyf

    plesk4lyf Member
    PartnerNOC

    Joined:
    May 21, 2018
    Messages:
    12
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Sydney
    cPanel Access Level:
    Root Administrator
    Hi Guys,

    What's the purpose of the files:
    /etc/userdatadomains
    and
    /etc/userdomains

    Doesn't the cPanel get all it's domain data from the /var/cpanel/userdata and /var/cpanel/users?

    Do the /etc/ files update each time a domain is added, modified or deleted?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,344
    Likes Received:
    1,852
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @plesk4lyf,

    While cPanel & WHM does utilize data from the files within /var/cpanel/userdata/$username/ and /var/cpanel/users/, these are not the only locations where account-related data is stored or read from. The /etc/userdomains and /etc/userdatadomains files include information about domain names, usernames, account owners, and IP addresses. Multiple features in cPanel & WHM rely on these files, however you should never have to manually modify them. The files are automatically updated as needed (e.g. adding a new domain, removing an existing domain).

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. plesk4lyf

    plesk4lyf Member
    PartnerNOC

    Joined:
    May 21, 2018
    Messages:
    12
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Sydney
    cPanel Access Level:
    Root Administrator
    Hey @cPanelMichael,

    Thank you!

    Sounds like I should experiment and rename /etc/userdomains & /etc/userdatadomains and see what happens!

    If I was to make a script to read user data, what would you consider to the authoritative files/methods to use?

    For example, I read that uapi Domaininfo::list_domains simply displays the data from /var/cpanel/userdata/$username/main files. So made a script to read the data straight from those files directly - cutting out the middleman. Meanwhile I could have used /etc/userdomains as well.

    Is one considered more authoritative than another?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,344
    Likes Received:
    1,852
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    I highly recommend using our API instead of manually obtaining the information from the files. The storage locations for configuration data can change over time, but the API functions are updated when those changes occur as they go through internal testing.

    Thank you.
     
    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