April 29, 2025 - 23:07
Useful CSF SSH Commands Image
Server Management

Useful CSF SSH Commands

Comments
If you ever accidentally ban your own IP and can't access your server’s WHM panel, you may need to remove the ban using CSF (ConfigServer Security & Firewall). In such cases, if WHM is not accessible, you can execute the following commands directly via SSH or the Terminal section in the WHM panel. Here are some handy CSF commands that might save the day:
COMMAND DESCRIPTION EXAMPLE USAGE
csf -e Enables CSF firewall. root@server[~]# csf -e
csf -x Disables CSF firewall. root@server[~]# csf -x
csf -s Starts firewall rules. root@server[~]# csf -s
csf -f Flushes all firewall rules. root@server[~]# csf -f
csf -r Restarts firewall rules. root@server[~]# csf -r
csf -a [IP_ADDRESS] [COMMENT] Allows the given IP and removes any blocks. Adds it to /etc/csf/csf.allow. root@server[~]# csf -a 10.15.20.30 HOME_IP
csf -td [IP_ADDRESS] [COMMENT] Temporarily blocks the given IP. root@server[~]# csf -td 123.123.123.123 TEMP_BAN
csf -tr [IP_ADDRESS] Removes the given IP from temporary allow/deny lists. root@server[~]# csf -tr 255.255.255.255
csf -tf Flushes all temporary allow/deny IPs. root@server[~]# csf -tf
csf -d [IP_ADDRESS] [COMMENT] Blocks the given IP. Adds it to /etc/csf/csf.deny. root@server[~]# csf -d 10.10.10.10 BRUTE_FORCE
csf -dr [IP_ADDRESS] Removes block for the specified IP. root@server[~]# csf -dr 10.10.10.10
csf -df Removes all entries in /etc/csf/csf.deny. root@server[~]# csf -df
csf -g [IP_ADDRESS] Searches for an IP in iptables or iptables6. root@server[~]# csf -g 10.10.10.10
csf -t Lists temporary allows/denies with TTL and comments. root@server[~]# csf -t
Note: The COMMENT field is optional but useful for future reference.

Related Articles

Comments ()

No comments yet. Be the first to comment!

Leave a Comment