Shawn Paul

Member
Apr 17, 2017
7
0
1
Nairobi
cPanel Access Level
Root Administrator
I've tried to follow the guidelines at;DNS Zone Reset ALL

However, I get an error when trying to add the dns after deleting. I'm logged in as root;

root@root [~]# /scripts/killdns abccc1111.org
abccc1111.org => deleted from root.
abccc1111.org => deleted from root.
abccc1111.org => deleted from svr.

root@root [~]# /scripts/add_dns --domain=abccc1111.org
No valid IP specified. Using 111.1111.111.1111
Sorry, the domain abccc1111.org is owned by another user (abccc11)

I'm able to delete and add via WHM but after selecting the associated domain in the 'Domain Owner information' section. My problem is there are hundreds of accounts to reset DNS to default and manually changing for each domain will take a long time.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello,

Are you sure the domain name in-question isn't added to an existing account as the primary domain name, or an alias/add-on domain name? You can check with a command such as:

Code:
grep $domain /etc/userdomains
If so, you'd need to first remove the domain name from the existing account before adding it to a new one.

Thank you.
 

Shawn Paul

Member
Apr 17, 2017
7
0
1
Nairobi
cPanel Access Level
Root Administrator
Hello,

Thanks for the quick reply.
The domain 'abccc1111.org' is rightfully owned by cpanel user 'abccc11'. What I wanted was to delete and re-add the DNS zone while logged in as root user.

I was trying for one user and if it worked then I would have used the following to reset for all cpanel users on the server:

#############
for i in `cat /etc/trueuserdomains | cut -d: -f1` ;do /scripts/killdns $i ;done
for i in `cat /etc/trueuserdomains | cut -d: -f1` ;do /scripts/add_dns --domain=$i ;done
#############

Is there a different [or better] way of resetting the DNS zones of all cPanel Accounts via SSH? I have a server which was recently migrated and some domains' A records are still pointing to the old server IP. Resetting DNS, or deleting and adding DNS for each domain in the new server is resolving the issue. Problems is that the server has hundreds of cpanel users. I wanted a way of resetting all DNS zones [for all cPanel users on the server] to default.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
There are no native features that will allow you to reset the zone for multiple DNS zones at the same time, however I encourage you to vote and add feedback to the existing feature request for this functionality at:

Multiple Domain (DNS Zone) Reset/Update

As a workaround, you could use the instructions on the following thread to replace the "A" record from one IP address to a different one:

Bulk DNS Zone Update

Thank you.
 

Shawn Paul

Member
Apr 17, 2017
7
0
1
Nairobi
cPanel Access Level
Root Administrator
This is noted with thanks.
I already used the guide at Bulk DNS Zone Update to successfully replace name servers on a different server yesterday.
For this server I've found that ns1 and ns2 are correct. Now I just need to ensure that the A record for all cpanel accounts points to the new server IP and not the old server IP. Is there a way of doing so via command line?
 

Shawn Paul

Member
Apr 17, 2017
7
0
1
Nairobi
cPanel Access Level
Root Administrator
Sorry, the issue of replacing A record seems mentioned in the thread you pointed to. It's just not very clear to me. I need a command to replace the old server IP with the new server IP in the A records.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463