Basic CSF Commands Updated on March 9, 2023 by InMotion Hosting Contributor 2 Minutes, 30 Seconds to Read In this Dedicated Hosting tutorial, we will cover basic CSF commands. The basic commands include Restarting Services, Allowing IPs, Blocking IPs, and Unblocking IPs, among others. After explaining what the command does, we will show you an example of the CSF Command. Service Control Commands Service CSF Commands IPTables Commands CSF Commands Block an IP address (permanently) Block an IP address (temporarily) Allow an IP Address Temporarily Allow an IP Address Unblock an IP (permanent block) Unblock an IP (temporary block) List temporary blocked IPs and block durations Remove all temporary IP blocks Log all SYN packets from an IP You must be logged into your Dedicated Server via SSH to run these commands. Service Control Commands Service CSF commands: Here is a breakdown of the csf service commands: service csf [start|stop|restart] Below is an example of the command you can run, highlighted in red: root@ded999 [~]# service csf restart IPtables Commands: The iptables may also need to be restarted for ‘hung’ rules. If you ever need to restart iptables, make sure you restart CSF afterward to apply the firewall rules. Below is a breakdown of iptables commands: iptables {start|stop|restart|condrestart|status|panic|save} Below is an example of a command you can run, highlighted in red: root@ded999 [~]# iptables restart CSF Commands Block an IP address (permanently): csf -d $ip Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -d 123.456.789 Block an IP address (temporarily): csf -td $ip $duration (duration is how long to block for (default:seconds, can use one suffix of h/m/d) Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -td 123.456.789 3600 Allow an IP Address: csf -a $ip Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -a 123.456.789 Temporarily Allow an IP Address: csf -ta $ip $duration (duration is how long to block for (default:seconds, can use one suffix of h/m/d) Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -ta 123.456.789 3600 Unblock an IP (permanent block): csf -dr $ip Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -dr 123.456.789 3600 Unblock an IP (temporary block): csf -tr $ip Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -tr 123.456.789 3600 List temporary blocked IPs and block durations: csf -t Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -t Remove all temporary IP blocks: csf -tf Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -tf Log all SYN packets from an IP: csf -w $ip Below is an example of the command you can run, highlighted in red: root@ded999 [~]# csf -w 123.456.789 Congratulations, now you are familiar with the basic CSF commands for Restarting Services, Allowing IP’s, Blocking IP’s, and Unblocking IP’s, among others! Share this Article IC InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles Understanding Linux Operating Systems How to Install Python 3.9 on CentOS 7 Speed Up grep Searches with LC_ALL=C How To Install RubyGems On Linux unrar and rar Commands 5 Ways to Find a File in Linux Setting Your PHP Settings in Command Line How to Check the Memory Usage on Linux How to Send Files to the Trash Can in Linux with Gio Trash How to Merge PDF Files in the Linux Terminal