How to Block/Unblock IPs from SSH?

How to Block or Unblock IPs From SSH
How to Block or Unblock IPs From SSH

Hi,

In this article, we’ll show you how to Block/Unblock IP Addresses in SSH. You can also Block/Unblock IP Addresses from WHM root for which we have already written an article. But, using SSH to ban/unban IP Addresses is more effective and less time-consuming because you don’t have to browse through the WHM interface in SSH.

Let’s do this.

Block An IP Address from SSH

Well, this can easily be done with a single-line command. Follow the below steps to Block/Unblock IP Addresses.

  • First of all, log into your SSH as a root.
Login to SSH as Root
Login to SSH as a root
  • Enter the below command.
/scripts/cphulkdblacklist 180.156.169.4

Note: Replace the dummy IP Address with the IP Address you want to blacklist.

  • If the cphulkd is enabled, the command will execute. Else, you’ll receive the following error.
[root@test ~]# /scripts/cphulkdblacklist 180.156.169.4
cphulkd is not enabled
  • If you see the above error, you’ll have to enable cphulkd from the WHM root. Let’s enable it.


 

Enable cPHulk Protection from WHM 

  • Log into WHM as a root user.
  • Either navigate to the Security Center > cPHulk Brute Force Protection or simply type cPHulk in the search bar and click on the result.
Type cPHulk in Search Bar
Type cPHulk in Search Bar
  • Hit the Off button to enable cPHulk Brute Force Protection and then switch back to the SSH.
Enable cPHulk Protection
Enable cPHulk Protection


  • Once cPHulk is enabled, move back to the SSH and run the previous command again.
  • You’ll receive the following result.
[root@test ~]# /scripts/cphulkdblacklist 180.156.169.4
180.156.169.4 has been blacklisted

That’s It.

You’ve successfully blocked an IP Address from SSH.

Blacklisted IP from SSH
Blacklisted IP from SSH

That’s how you can easily Block/Ban IP Addresses from SSH. Now let’s unblock the IP Address.

Unblock An IP Address from SSH

  • Again, log into the SSH as a root user.
  • Run the below command and hit enter.
/scripts/cphulkdwhitelist 180.156.169.4

Note: Do not forget to change the dummy IP Address with the IP Address you want to unblock/unban.

  • Once you’ll hit the command, you’ll see the below result.
[root@test ~]# /scripts/cphulkdwhitelist 180.156.169.4
180.156.169.4 has been whitelisted

That’s It.

You’ve Successfully unblocked an IP Address using SSH.

Unblocked an IP from SSH
Unblocked an IP from SSH

Now you know how to Block or Unblock IP Addresses from SSH root. I hope this helps you. If not, you can open a free support ticket from Redserverhost.com. Our experienced Technical Support Team will be happy to assist you.

Also See:  Generate SSH Keys in Windows & MacOS

Other than this, you can contact us on Facebook or Twitter for any further inquiries or suggestions.

Scroll to Top