Your Webhosting Questions
Answered by the Webhosting Experts

How to Open Certain Ports in CSF Firewall on a Dedicated Server

CSF firewall is a popular security tool for Linux servers. It allows you to control the incoming and outgoing network traffic by opening or closing ports. Ports are like doors that let different types of data pass through. 

Follow the instructions below to add a port into your CSF Firewall:

  1. First, log in to your server and open the file /etc/csf/csf.conf with your editor of choice. For example, if we use nano, we will use nano /etc/csf/csf.conf. This command will open the CSF configuration file.
  2. Within the configuration file, we will need to find the following section as listed below.
    Screenshot showing the /etc/csf/csf.conf file.
  3. Here we can add the port number at the end of each line before the quote mark (“). As an example, view the change made below where I’ve added port 8252.
    Screenshot of the /etc/csf/csf.conf file highlighting the addition of port 8252.
  4. Once that is done, save the file, and exit.
  5. Proceed to restart the firewall using systemctl restart csf or service csf restart (Depending on the OS), as shown below.
    Screenshot showing the results of the systemctl restart csf command.

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your account or if you are on the go, please reach out from your valid account email to us here at: [email protected]. We are also available to you through our phone and live chat system 24/7/365.

Tags +