How to Blacklist/Whitelist IP Address via SSH

As we continue our series on the cPHulk security features, we will show you the steps to blacklist and whitelist IP addresses via SSH. In the last guide we showed you how to blacklist and whitelist IP addresses in the Web Host Manager or WHM. But doing this with command line using SSH can save time since you do not have to go through the WHM interface.

Blacklist IP Address

  1. Connect to your server via SSH as the ‘root’ user.
     
  2. Run the following command, but be sure to replace the example IP address (123.45.67.89) with the address you want to blacklist.

    /scripts/cphulkdblacklist 123.45.67.89

    You will then see a response similar to the following:

    123.34.56.78 has been blacklisted

     

    At this time the IP address has been blacklisted. repeat these steps for any IP addresses you want to blacklist.

     

Now that you know how to blacklist an IP address via SSH, we will show you how to whitelist IP addresses.

Whitelist IP Address

  1. Connect to your server via SSH as the ‘root’ user.
     
  2. Run the following command, but be sure to replace the example IP address (123.45.67.89) with the address you want to whitelist.

    /scripts/cphulkdwhitelist 123.45.67.89

    You will then see a response similar to the following:

    123.34.56.78 has been whitelisted

     

    At this time the IP address has been whitelisted. repeat these steps for any IP addresses you want to whitelist.

     

Congratulations, now you know how to whitelist and blacklist IP addresses via SSH!

Secure your websites with our Dedicated Server Hosting and a hardware firewall today.

JB
John-Paul Briones Content Writer II

John-Paul is an Electronics Engineer that spent most of his career in IT. He has been a Technical Writer for InMotion since 2013.

More Articles by John-Paul

Was this article helpful? Join the conversation!