-
cPanel
- How to Check cPanel Version
- How to Add a new Domain in cPanel hosting - Addon Domain
- How to Add, Edit and Manage DNS in cPanel?
- How to Configure Webmail Email ID On Your Mobile Device?
- How to Configure Webmail Email ID On Your PC / Laptop?
- How to create a Sub Domain in cPanel Hosting
- How to Disable IPv6 in cPanel
- How to Forcefully Suspend a cPanel Account via SSH (Using suspendacct)
- How to Install & Activate SSL in cPanel Hosting
- How to install Imagick PHP extension (From SSH / Terminal)
- How to install Imagick PHP extension (From WHM interface)
- How to Login to cPanel at myglobalHOST?
- How to Restart Services in cPanel using SSH Access
- How to Rollback a cPanel Update: Downgrade cPanel Version
- How to take a full account backup in cPanel (Manually)?
- IP Blocking and Iptables in linux / cPanel
- Repair & Optimize MySQL database on cPanel/WHM Server
- Show Remaining Articles (2) Collapse Articles
-
FAQs
- How to Access Your myglobalHOST Members Area?
- How To Add Funds In Myglobalhost Account?
- How to Buy And Customize Hosting Plan?
- How to Get a Refund?
- How To Open A Ticket at Myglobalhost?
- How to Purchase Cloud Hosting Plan?
- How to Purchase Shared Hosting Plan?
- How to Upgrade a Hosting Plan?
- Invoice Still Shows As Unpaid Even After Payment
- What are the Support Timings?
- What Payment Methods Are Available at Myglobalhost?
- Where to Find myglobalHOST Nameservers?
-
Wordpress
- Fatal error: Allowed Memory Size Error in WordPress (Increase WordPress Memory Limit)
- Fixing Compatibility Issues Between LiteSpeed Cache and WooCommerce
- How to fix error 404 in Wordpress Website?
- How to Install WordPress In cPanel Using Softaculous
- How to Setup, Edit, Manage Cron Jobs in Wordpress (wp-cron)
- How to Stop BAD BOTS in WordPress (Via Plugin)
- Quickly Fix Error 503 Service Unavailable in WordPress
- WordPress Dashboard Broken Design Issue
-
Others
- Enable Auto Scaling in Cloud Hosting
- Force www in your .htaccess file in cPanel (For WordPress & All Sites)
- General Terms & Conditions
- How to Backup MySQL Databases with mysqldump
- How to Fix & Rebuild Apache in cPanel/WHM
- How to Force SSL / HTTPS using .htaccess (For WordPress & All Sites)
- How to install MariaDB Instead of MySQL8 in cPanel/WHM
- How to Reset LiteSpeed Web Admin Password
- How to Restart Services in cPanel using SSH Access
- IP Blocking and Iptables in linux / cPanel
- Privacy Policy
- Stop BAD BOTS in cPanel / WHM Using ModSecurity Custom Rule Set (Easiest Way)
- Whitelisting Multiple IPs in Imunify360
- How to Force Delete DNS from Command Line - CLI in WHM
-
Blog
-
Comparison
How to Force Delete DNS from Command Line – CLI in WHM
Introduction
In certain situations, you might need to force delete a DNS zone from your WHM (Web Host Manager) server using the command line interface (CLI). This is typically required when a standard DNS zone deletion through the WHM interface fails or encounters issues. This guide will walk you through the steps to remove a DNS zone using the command line in WHM, ensuring a clean and efficient removal process.
This method is particularly useful in scenarios where:
- The DNS zone deletion process is stuck in WHM.
- You are experiencing errors when trying to delete the DNS zone through the WHM interface.
- You need to automate DNS zone removal via scripts.
By using the command line, you can bypass potential interface issues and directly instruct the server to forcefully delete the DNS zone.
Prerequisites
Before you begin, ensure you have the following:
- WHM Access: You need administrative access to your WHM server.
- Root Access via SSH: You will need to connect to your server via SSH as the root user. This is necessary to execute commands with the required privileges.
Steps to Force Delete DNS Zone from Command Line – CLI in WHM
Follow these steps to force remove a DNS zone using the command line in WHM:
-
Access your server via SSH:
- Open your terminal application (like Terminal on macOS or PuTTY on Windows).
- Connect to your server using the SSH command, replacing
your_server_ip
with your server’s IP address and ensure you are logging in as theroot
user.
-
Identify the DNS Zone to Delete:
- Before proceeding with the force deletion, you need to identify the exact name of the DNS zone you want to remove. This is usually the domain name for which the DNS zone is configured. For example, if you want to delete the DNS zone for
example.com
, thenexample.com
is your DNS zone name.
- Before proceeding with the force deletion, you need to identify the exact name of the DNS zone you want to remove. This is usually the domain name for which the DNS zone is configured. For example, if you want to delete the DNS zone for
-
Execute the Force Delete Command:
- Use the following command to force delete the DNS zone. Replace
domain.com
with the actual domain name of the DNS zone you want to remove.
whmapi1 killdns domain='example.com'
whmapi1
: This is the command-line interface to the WHM API 1 (Application Programming Interface). We are using it to interact with WHM functionalities.killdns
: This is the specific WHM API 1 function we are calling, designed to remove DNS zones. It effectively “kills” the DNS zone.domain='domain.com'
: This parameter specifies the DNS zone that you want to delete. Replacedomain.com
with your actual domain name.
- Use the following command to force delete the DNS zone. Replace
-
Verify DNS Zone Deletion:
-
After executing the command, WHM will provide an output indicating the success or failure of the operation. A successful deletion will typically show a “result: 1” message.
-
You can further verify the deletion by:
- Checking the DNS Zones list in your WHM interface to ensure the zone is no longer present.
- Using the following command in the CLI to list all DNS zones and confirm the deleted zone is not listed:
whmapi1 list_dns_zones
-
This article also solves the below issues:
-
How to Fix “A DNS entry for the domain already exists” error in WHM/cPanel?
- If you encounter the error message “A DNS entry for the domain already exists” when trying to create a new cPanel account or add a domain, it often indicates a lingering or corrupted DNS zone in WHM. Even if you cannot see the zone in the WHM interface, it might still exist in the backend DNS configuration.
- Using the
whmapi1 killdns domain='example.com'
command (as described above) can forcefully remove this existing, potentially hidden, DNS zone. After force deleting, you should be able to create the cPanel account or add the domain without encountering the “DNS entry already exists” error.
-
How to Force remove DNS record permanently.
- This article directly addresses how to force remove a DNS record permanently (specifically, a DNS zone, which is a collection of DNS records for a domain).
- The
whmapi1 killdns domain='example.com'
command ensures the permanent removal of the entire DNS zone for the specified domain from your WHM server. This is a forceful and irreversible action, effectively deleting all DNS records associated with that domain within WHM’s DNS management.
Important Considerations:
- Force deletion is irreversible: Once you force delete a DNS zone, it is permanently removed. Ensure you have backed up any necessary DNS records before proceeding.
- Use with caution: Only use the
killdns
command when standard deletion methods are failing. Incorrectly forcing deletion can lead to unintended consequences if not used properly. - Alternative Force Delete Command: In certain rare situations, if
killdns
does not suffice, you can try the commandwhmapi1 remove_dns_zone zone=domain.com force=1
This command also forces deletion and might be helpful in very specific edge cases. However,
killdns
is generally the recommended command for forceful removal. - Propagation time: After deleting a DNS zone, allow time for DNS propagation to complete. During this time, some users might still be directed to the old server until the DNS changes fully propagate across the internet.
Conclusion
By following these steps, you can effectively force delete a DNS zone from the command line in WHM. This method provides a powerful way to resolve DNS zone removal issues, fix “DNS entry already exists” errors, and ensure permanent DNS record removal, thus helping to maintain your server efficiently. Remember to use this command with caution and always verify the DNS zone deletion to ensure the process is successful.
If you have any further questions or encounter any issues, please contact our support team at myglobalHOST for assistance.