Unable to terminate account after emptying /var/cpanel/users/<user> file

sangeeths

Member
May 25, 2021
22
6
78
India
cPanel Access Level
Root Administrator
Hi there,

I work on a cPanel plugin and I was trying to debug an error from a customer by trying to reproduce it on our test machine. The error was happening when calling the REST version of whmapi1 --output=jsonpretty accountsummary and the error was as follows:

Code:
API failure: Failed to read data: Is a directory at /usr/local/cpanel/Cpanel/LoadFile/ReadFast.pm line 126.
For this, I had to go and fiddle around with the /var/cpanel/users/user file. I tried to remove it completely (but made a .bak from it before doing so) and tried moving it back again. But this didn't produce the same error as above. I then tried to keep it there but empty the file. And bingo! I found the same error.

To continue debugging, I wanted to remove this account and create another account. However, I am facing a similar error plus one more while trying to terminate the account:

1638454940358.png

I tried a bunch of different things including some of the steps mentioned here. I thought it could be that cached file is outdated so I ran the relevant commands from the doc but running userdata_update showed the following error:

Code:
Skipping cPanel user shru1. Missing main domain.
I also checked /usr/local/cpanel/logs/error_log when I tried to delete and it shows the following error:

Code:
[2021-12-02 14:27:10 +0000] info [xml-api] Error: invalid domain [removeacct] version [1]
I'm quite unsure what to do at this point. I'd appreciate it if I could get some help for the following:

1. Is there a way to recreate a corrupt/empty user config file and resolve this error?
2. Is there a way to resolve this issue when there's a backup of the user config file present?
3. Is there a way to ignore this error and proceed to remove the account from WHM?

The cPanel version is 100.0 (build 4) and the server is running CentOS Linux 7.
 

cPanelAnthony

Administrator
Staff member
Oct 18, 2021
975
95
103
Houston, TX
cPanel Access Level
Root Administrator
Hello! I would like to address all your questions but would like some information first. I want to understand exactly how this configuration for the domain is messed up. Could you run the "acctinfo" command against your domain and let me know if there is any error output?

How to use acctinfo to troubleshoot issues
 

sangeeths

Member
May 25, 2021
22
6
78
India
cPanel Access Level
Root Administrator
Hey @cPanelAnthony, I've included the output below. It said "shru1 not found" when I ran without the --cruft option.

Code:
TEST-SERVER [[email protected] sangeeth.s]$ acctinfo shru1 --cruft
acctinfo - Version: 2.5.31
===================================================================================
CRUFT CHECK
===================================================================================
From your query of shru1 I have determined:
shru1.com (shru1) is active since Tue Nov 30 07:25:45 2021
-----------------------------------------------------------------------------------
Searching the following files for user: shru1
/etc/passwd                                                    [EXISTS]
/etc/group                                                     [EXISTS]
/etc/shadow                                                    [EXISTS]
/etc/gshadow                                                   [EXISTS]
/etc/quota.conf is either empty or missing                   [SKIPPING]
/etc/dbowners                                                 [MISSING]
/etc/trueuserowners                                           [MISSING]
/var/cpanel/databases/users.db is either empty or missing    [SKIPPING]
/etc/userdatadomains.json                                      [EXISTS]
/var/cpanel/quotawarned                                       [MISSING]
/etc/nocgiusers is either empty or missing                   [SKIPPING]
/etc/userips                                                  [MISSING]
/etc/userbwlimits                                             [MISSING]
/var/cpanel/resellers is either empty or missing             [SKIPPING]
Searching the following files for domain: shru1.com
/etc/userdomains                                              [MISSING]
/etc/trueuserdomains                                          [MISSING]
/etc/userdatadomains                                           [EXISTS]
/etc/domainusers                                              [MISSING]
/etc/domainips                                                [MISSING]
/etc/localdomains                                              [EXISTS]
/etc/remotedomains is either empty or missing                [SKIPPING]
/etc/demousers is either empty or missing                    [SKIPPING]
/etc/email_send_limits                                        [MISSING]
/etc/demoids is either empty or missing                      [SKIPPING]
/etc/manualmx                                                 [MISSING]
/etc/demodomains is either empty or missing                  [SKIPPING]
/etc/ssldomains is either empty or missing                   [SKIPPING]
/var/cpanel/moddirdomains                                     [MISSING]
/home/shru1                                                    [EXISTS]
     \_ etc - EXISTS
     \_ mail - EXISTS
     \_ public_html - EXISTS
     \_ ssl - EXISTS
     \_ tmp - EXISTS
/var/cpanel/userdata/shru1                                     [EXISTS]
     \_ /var/cpanel/userdata/shru1/main
     \_ /var/cpanel/userdata/shru1/shru1.com
     \_ /var/cpanel/userdata/shru1/shru1.com_SSL
/var/cpanel/users/shru1                                        [EXISTS]
/var/cpanel/overquota/shru1                                   [MISSING]
/var/cpanel/mainips/shru1                                     [MISSING]
/var/cpanel/databases/grants_shru1.yaml                        [EXISTS]
/var/cpanel/databases/shru1.json                               [EXISTS]
/var/cpanel/databases/dbindex.db.json                         [MISSING]
/etc/proftpd/shru1                                             [EXISTS]
/var/cpanel/bandwidth/shru1.sqlite                             [EXISTS]
/var/cpanel/bwlimited/shru1                                   [MISSING]
/var/cpanel/bwlimited/shru1.com                               [MISSING]
/etc/valiases/shru1.com                                        [EXISTS]
/etc/vfilters/shru1.com                                        [EXISTS]
/var/named/shru1.com.db                                        [EXISTS]
/etc/apache2/logs/domlogs/shru1.com                            [EXISTS]
/etc/named.conf                                                [EXISTS]
/etc/apache2/conf/httpd.conf                                   [EXISTS]
Skipping MySQL checks - username undetermined!
Checking for any MySQL users in mysql.user table
    \_ shru1
Checking for any MySQL users and databases in mysql.db table
    \_ None
===================================================================================
 

sangeeths

Member
May 25, 2021
22
6
78
India
cPanel Access Level
Root Administrator
Hello again. Actually, could you try running acctinfo against the domain name instead of the username?
Sure, JSYK, we don't own these domains and we don't have the DNS and things all configured to make things work properly. Since we just need to access a user's cPanel interface to test things out, we usually just create the accounts to test hook flows and cPanel UI integrations. Not sure if that could help this case but, here's the output:

Code:
TEST-SERVER [[email protected] opt]$ acctinfo shru1.com --cruft
acctinfo - Version: 2.5.31
===================================================================================
CRUFT CHECK
===================================================================================
From your query of shru1.com I have determined:
shru1.com (shru1) is active since Tue Nov 30 07:25:45 2021

-----------------------------------------------------------------------------------
Searching the following files for user: shru1
/etc/passwd                                                    [EXISTS]
/etc/group                                                     [EXISTS]
/etc/shadow                                                    [EXISTS]
/etc/gshadow                                                   [EXISTS]
/etc/quota.conf is either empty or missing                   [SKIPPING]
/etc/dbowners                                                 [MISSING]
/etc/trueuserowners                                           [MISSING]
/var/cpanel/databases/users.db is either empty or missing    [SKIPPING]
/etc/userdatadomains.json                                      [EXISTS]
/var/cpanel/quotawarned                                       [MISSING]
/etc/nocgiusers is either empty or missing                   [SKIPPING]
/etc/userips                                                  [MISSING]
/etc/userbwlimits                                             [MISSING]
/var/cpanel/resellers is either empty or missing             [SKIPPING]
Searching the following files for domain: shru1.com
/etc/userdomains                                              [MISSING]
/etc/trueuserdomains                                          [MISSING]
/etc/userdatadomains                                           [EXISTS]
/etc/domainusers                                              [MISSING]
/etc/domainips                                                [MISSING]
/etc/localdomains                                              [EXISTS]
/etc/remotedomains is either empty or missing                [SKIPPING]
/etc/demousers is either empty or missing                    [SKIPPING]
/etc/email_send_limits                                        [MISSING]
/etc/demoids is either empty or missing                      [SKIPPING]
/etc/manualmx                                                 [MISSING]
/etc/demodomains is either empty or missing                  [SKIPPING]
/etc/ssldomains is either empty or missing                   [SKIPPING]
/var/cpanel/moddirdomains                                     [MISSING]
/home/shru1                                                    [EXISTS]
     \_ etc - EXISTS
     \_ mail - EXISTS
     \_ public_html - EXISTS
     \_ ssl - EXISTS
     \_ tmp - EXISTS
/var/cpanel/userdata/shru1                                     [EXISTS]
     \_ /var/cpanel/userdata/shru1/main
     \_ /var/cpanel/userdata/shru1/shru1.com
     \_ /var/cpanel/userdata/shru1/shru1.com_SSL
/var/cpanel/users/shru1                                        [EXISTS]
/var/cpanel/overquota/shru1                                   [MISSING]
/var/cpanel/mainips/shru1                                     [MISSING]
/var/cpanel/databases/grants_shru1.yaml                        [EXISTS]
/var/cpanel/databases/shru1.json                               [EXISTS]
/var/cpanel/databases/dbindex.db.json                         [MISSING]
/etc/proftpd/shru1                                             [EXISTS]
/var/cpanel/bandwidth/shru1.sqlite                             [EXISTS]
/var/cpanel/bwlimited/shru1                                   [MISSING]
/var/cpanel/bwlimited/shru1.com                               [MISSING]
/etc/valiases/shru1.com                                        [EXISTS]
/etc/vfilters/shru1.com                                        [EXISTS]
/etc/vdomainaliases/shru1.com                                  [EXISTS]
/var/named/shru1.com.db                                        [EXISTS]
/etc/apache2/logs/domlogs/shru1.com                            [EXISTS]
/etc/named.conf                                                [EXISTS]
/etc/apache2/conf/httpd.conf                                   [EXISTS]
Skipping MySQL checks - username undetermined!
Checking for any MySQL users in mysql.user table
    \_ shru1
Checking for any MySQL users and databases in mysql.db table
    \_ None
===================================================================================
 

sangeeths

Member
May 25, 2021
22
6
78
India
cPanel Access Level
Root Administrator
Would it be possible for you to open a support ticket using the link in my signature? Otherwise, your web hosting provider should be able to do so.
I was actually in the middle of opening the ticket and collecting the info which is when I checked the same server again and... the problem seems to have fixed itself? o_O

The problematic account was now gone, even though the config file still remained in /var/cpanel/users. I'm not sure how. I tried to reproduce the problem again with a different account by making a .bak of the file, emptying the file and the problem came back. But this time, I was able to copy the .bak file back and the problem seems to disappear. I tried a few different things to reproduce the original problem which used to be present even after .bak file was restored but I couldn't.

I'll update this thread in case if I stumble upon the same issue again but all the stands valid now is my question "Is there a way to ignore this error and proceed to remove the account from WHM?".
 

HostNoc

Well-Known Member
Feb 20, 2020
117
28
28
Ontario
cPanel Access Level
Root Administrator
HI

Can you please run following /scripts/killacct USERNAME and then try to terminate account?

You must to check the /var/cpanel/users/USER
The "DNS=" must to be "DNS=domain.com"

Regards
HostNoc
 
  • Like
Reactions: cPanelAnthony