This article provides instructions for a Server Administrator to regain access to a server when a firewall rule has inadvertently blocked essential management ports, such as those used for WHM or SSH. This procedure applies to servers where the firewall is managed by the user.
Important: This procedure is only applicable if you have an alternative method of access to the server, such as a web console or a physical console, as the standard network ports are currently blocked.
Before you begin
You will need:
Server Administrator access to the Hostek management console.
Access to the server's console (e.g., via a web-based console or a local terminal).
A valid login for the server's root or administrative account.
Recovering access via the server console
If a firewall rule blocks your ability to connect via SSH or WHM, you must use a direct console connection to modify the firewall rules.
Log in to your server using the provided console access.
Access the command line interface.
Identify the firewall service currently in use (e.g.,
iptables,firewalld, orufw).Disable the firewall service to restore immediate connectivity.
For firewalld:
systemctl disable firewalld systemctl stop firewalld
For iptables:
iptables -F
For ufw:
ufw disable
Verify that you can now connect to the server via SSH or the WHM interface.
Once access is restored, identify the specific rule that caused the lockout and create a more specific allow rule for your IP address or the required ports.
Re-enable the firewall service.
For firewalld:
systemctl enable firewalld systemctl start firewalld
For iptables: (Ensure rules are saved via
iptables-saveor your distribution's specific persistence tool).For ufw:
ufw enable
Confirm the result
You can successfully log in to the server via SSH.
The WHM interface is accessible via your web browser.
The firewall service is active and running.
Limitations
This procedure assumes the server is running a standard Linux distribution. The specific commands for disabling the firewall may vary slightly depending on the distribution and the specific firewall software installed. If you are unsure which firewall is active, the iptables -F command is the most common method to flush current rules and restore access.
