plesk4lyf

Member
PartnerNOC
May 21, 2018
23
2
3
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?
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
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.
 

plesk4lyf

Member
PartnerNOC
May 21, 2018
23
2
3
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?
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
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.