{"id":13776,"date":"2019-11-11T12:26:47","date_gmt":"2019-11-11T09:26:47","guid":{"rendered":"https:\/\/www.hyyat.com\/knowledgebase\/%d8%a7%d9%88%d8%a7%d9%85%d8%b1-%d8%ac%d8%af%d8%a7%d8%b1-%d8%a7%d9%84%d8%ad%d9%85%d8%a7%d9%8a%d8%a9-csf-%d8%a7%d9%84%d9%85%d9%87%d9%85%d8%a9-%d8%b9%d9%86-%d8%b7%d8%b1%d9%8a%d9%82-ssh\/"},"modified":"2026-10-21T19:00:23","modified_gmt":"2026-10-21T16:00:23","password":"","slug":"important-csf-firewall-commands-via-ssh","status":"publish","type":"docs","link":"https:\/\/www.hyyat.com\/en\/knowledgebase\/important-csf-firewall-commands-via-ssh\/","title":{"rendered":"Important CSF firewall commands via SSH"},"content":{"rendered":"<p><span style=\"color: #ff0000;\"><strong>Important CSF firewall commands via SSH<\/strong><\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-10560 size-full\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2019\/11\/ConfigServer_SecurityFirewall_csf_logo.png\" alt=\"\u0627\u0648\u0627\u0645\u0631 \u062c\u062f\u0627\u0631 \u0627\u0644\u062d\u0645\u0627\u064a\u0629 CSF \u0627\u0644\u0645\u0647\u0645\u0629 \u0639\u0646 \u0637\u0631\u064a\u0642 SSH\" width=\"317\" height=\"127\" srcset=\"https:\/\/www.hyyat.com\/zasogooh\/2019\/11\/ConfigServer_SecurityFirewall_csf_logo.png 317w, https:\/\/www.hyyat.com\/zasogooh\/2019\/11\/ConfigServer_SecurityFirewall_csf_logo-300x120.png 300w\" sizes=\"(max-width: 317px) 100vw, 317px\" \/><\/p>\n<p>In Linux servers, it is necessary to install a firewall that blocks suspicious processes on the server.<\/p>\n<p>From blocking any IP addresses we would like to block easily and one of the best free programs that work as a firewall that<\/p>\n<p>It can be installed is the ConfigServer Security &amp; Firewall program, known as csf, and it is always preferred to use it on servers.<\/p>\n<p>Which works in the control panel whm\/cpanel, as it is designed in such a way that it works automatically by blocking IP addresses that try to<\/p>\n<p>Log in with wrong information a lot and you can see all csf details through the following <a href=\"https:\/\/www.configserver.com\/cp\/csf.html\" target=\"_blank\" rel=\"noopener\"><strong>link<\/strong><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>In this lesson, we will review important CSF firewall commands via SSH<\/strong><\/p>\n<h4><span style=\"color: #ff0000;\">To get a list of all options, please use these commands<\/span><\/h4>\n<p><code>csf --help<br \/>\nman csf<\/code><\/p>\n<p>Firewall installation path : \/etc\/csf<br \/>\nmain settings file : \/etc\/csf\/csf.conf<\/p>\n<h4><span style=\"color: #ff0000;\">Restart the firewall<\/span><\/h4>\n<p><code>csf -r<\/code><\/p>\n<h4><span style=\"color: #ff0000;\">Turn on the firewall<\/span><\/h4>\n<p><code>csf -s<\/code><\/p>\n<h4><span style=\"color: #ff0000;\">Enable CSF (meaning when the server restarts, the csf is running)<\/span><\/h4>\n<p><code>csf -e<\/code><\/p>\n<h4><span style=\"color: #ff0000;\">Disable CSF (meaning when the server restarts, the csf does not work)<\/span><\/h4>\n<p><code>csf -x<\/code><\/p>\n<h4><span style=\"color: #ff0000;\">Remove and unblock all IPs on the server<\/span><\/h4>\n<p><code>csf -df<\/code><\/p>\n<h4><span style=\"color: #ff0000;\">ip ban one<\/span><\/h4>\n<p><code>csf -d 000.000.000.000<\/code><\/p>\n<p><strong>000.000.000.000 =IP to be blocked<\/strong><\/p>\n<h4><span style=\"color: #ff0000;\">Activate one IP<\/span><\/h4>\n<p><code>csf -a 000.000.000.000<\/code><\/p>\n<p><strong>000.000.000.000 = IP to activate (remove from ban)<br \/>\n<\/strong><\/p>\n<h4><span style=\"color: #ff0000;\">Clear all IP addresses from temporary IP entries<\/span><\/h4>\n<p><code>csf -tf<\/code><\/p>\n<p>Now if you want to manually search for a specific IP to unblock it, unblock it, or even attend and stop it<\/p>\n<p>You find all the IP that is blocked on the server you find it in this file<\/p>\n<p>&nbsp;<\/p>\n<p><code>nano \/etc\/csf\/csf.deny<\/code><\/p>\n<p>All IPs where the white is located are not or the trusted IP<\/p>\n<p><code>nano \/etc\/csf\/csf.allow<\/code><\/p>\n<p><span style=\"color: #339966;\"><strong>Note: The IP addresses listed in this file will not be ignored by lfd, so it can still be blocked. If you don&#8217;t want to lfd block an IP address, you should add it to csf.ignore<\/strong><\/span><\/p>\n<h4>Greetings from the <a href=\"\/\/www.hyyat.com\/en\" target=\"_blank\" rel=\"noopener\">Hyyat Host<\/a> team for hosting<\/h4>\n<p class=\"hy-rel\"><strong>Related service:<\/strong> <a href=\"https:\/\/www.hyyat.com\/%d8%a5%d8%af%d8%a7%d8%b1%d8%a9-%d8%a7%d9%84%d8%b3%d9%8a%d8%b1%d9%81%d8%b1%d8%a7%d8%aa\/\">server management<\/a> from Hyyat Host, with technical support that replies within 24 hours.<\/p>\n<div class=\"hy-relkb\" style=\"background:#f6f7fb;border-left:4px solid #1dca94;border-radius:10px;padding:14px 18px;margin:28px 0 10px;line-height:1.8\"><strong>Related guides<\/strong><\/p>\n<ul style=\"margin:8px 0 6px;padding-left:20px\">\n<li><a href=\"https:\/\/www.hyyat.com\/knowledgebase\/%d8%aa%d8%ad%d8%b3%d9%8a%d9%86-%d8%ae%d8%a7%d8%af%d9%85-%d8%a7%d9%84%d9%88%d9%8a%d8%a8-%d8%a7%d8%a8%d8%a7%d8%aa%d8%b4%d9%8a-%d8%b9%d9%84%d9%8a-whm%d8%9f\/\">Optimizing Apache web server on WHM?<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/knowledgebase\/%d8%aa%d8%ad%d8%af%d9%8a%d8%af-%d8%b9%d8%af%d8%af-%d8%a5%d8%b1%d8%b3%d8%a7%d9%84-%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d8%a8%d8%b1%d9%8a%d8%af-%d8%a8%d8%a7%d9%84%d8%b3%d8%a7%d8%b9%d8%a9-%d9%81\/\">Limiting the number of mails sent per hour in WHM?<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/knowledgebase\/%d8%a7%d8%b5%d9%84%d8%a7%d8%ad-%d8%ae%d8%b7%d8%a3-cc-error-country-code-lookups-setting-mm_license_key-must-be-set\/\">Fix CC Error: Country Code Lookups setting MM_LICENSE_KEY must be set<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Important CSF firewall commands via SSH In Linux servers, it is necessary to install a firewall that blocks suspicious processes on the server. From blocking any IP addresses we would like to block easily and one of the best free programs that work as a firewall that It can be installed is the ConfigServer Security [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"_templately_pack_id":"","_templately_imported_at":"","_templately_source":"","_templately_import_session_id":"","footnotes":""},"doc_category":[2734],"doc_tag":[2796],"class_list":["post-13776","docs","type-docs","status-publish","hentry","doc_category-whm-cpanel-control-panels","doc_tag-csf-en"],"year_month":"2026-11","word_count":386,"total_views":"357","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"ahmed fathy","author_nicename":"ahmed-fathy","author_url":"https:\/\/www.hyyat.com\/en\/author\/ahmed-fathy\/"},"doc_category_info":[{"term_name":"whm\/cpanel control panels","term_url":"https:\/\/www.hyyat.com\/en\/kb\/whm-cpanel-control-panels\/"}],"doc_tag_info":[{"term_name":"CSF","term_url":"https:\/\/www.hyyat.com\/en\/docs-tag\/csf-en\/"}],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/13776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/comments?post=13776"}],"version-history":[{"count":0,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/13776\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media?parent=13776"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_category?post=13776"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_tag?post=13776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}