Skip to main content

Purpose of /etc/userdomains

Comments

5 comments

  • cPanelMichael
    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.
    0
  • plesk4lyf
    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
    0
  • cPanelMichael
    If I was to make a script to read user data, what would you consider to the authoritative files/methods to use?

    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.
    0
  • plesk4lyf
    This is an old thread but I'm going to bump it anyway since it's the top result when searching "/etc/userdatadomains" in google. @cPanelLauren can you advise what the fields are in the /etc/userdatadomains file? It looks like it goes: Domain: username==reseller==domaintype==????==DocumentRoot==HTTP_IP&Port==HTTPS_IP&Port====????==???? Sometimes the last field is blank while other times it's a multiphp version. Are blank and inherit effectively the same?
    0
  • cPanelLauren
    You've got everything correct with the fields - domains that haven't specifically been set to inherit or assigned a PHP version are listed as blank there - the 0 is related to ipv6 and having a dedicated IPv6 address. whmapi1 function get_domain_info grabs all this info too docroot: /home/cptest/public_html domain: thisisatestdomain.com domain_type: parked ipv4: ipv4_ssl: ipv6: ~ ipv6_is_dedicated: 0 modsecurity_enabled: 1 parent_domain: cptest.com php_version: inherit port: 80 port_ssl: 443 user: cptest user_owner: cptest
    So if we broke the output down comparing it to what's in userdatadomains (using my output): domain:user==user_owner==domain_type==parent_domain==docroot==HTTP_IP:port==HTTPS_IP:port==ipv6(it's null)==ipv6_is_dedicated==php_version
    note that there are four ==== instead of two - this is because ipv6 has a null value ~ This is it in userdatadomains: thisisatestdomain.com: cptest==cptest==parked==cptest.com==/home/cptest/public_html==:80==:443====0==inherit
    0

Please sign in to leave a comment.