{"id":18360,"date":"2026-09-29T21:06:26","date_gmt":"2026-09-29T18:06:26","guid":{"rendered":"https:\/\/www.hyyat.com\/knowledgebase\/open-port-csf-firewall-whm\/"},"modified":"2026-11-22T18:52:49","modified_gmt":"2026-11-22T15:52:49","password":"","slug":"open-port-csf-firewall-whm","status":"publish","type":"docs","link":"https:\/\/www.hyyat.com\/en\/knowledgebase\/open-port-csf-firewall-whm\/","title":{"rendered":"Opening a Port in the CSF Firewall: From WHM or csf.conf, Plus the Common cPanel Ports"},"content":{"rendered":"<div class=\"hkb\" dir=\"ltr\">\n<div class=\"hkb-tldr\"><b>In two lines<\/b>In <b>WHM, then Plugins, then ConfigServer Security &amp; Firewall<\/b> click <b>Firewall Configuration<\/b>, add the port number to <b>TCP_IN<\/b> for incoming connections (or TCP_OUT for outgoing), comma separated, then click <b>Change<\/b> and <b>Restart csf+lfd<\/b>.<\/div>\n<div class=\"hy-vid\"><div style=\"width: 1280px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-18360-1\" width=\"1280\" height=\"720\" poster=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-srv-csfport-en.jpg\" preload=\"none\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-srv-csfport-en.mp4?_=1\" \/><a href=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-srv-csfport-en.mp4\">https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-srv-csfport-en.mp4<\/a><\/video><\/div><\/div>\n<div class=\"hkb-note\"><b>The situation:<\/b> A developer has installed an app on port 8443, or a site needs to reach an external service on an unusual port, and the connection fails. Nine times out of ten the port is closed in CSF.<\/div>\n<h2>First, know the direction<\/h2>\n<div class=\"hkb-tbl\">\n<table>\n<thead>\n<tr>\n<th>Setting<\/th>\n<th>Controls<\/th>\n<th>Example<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><b>TCP_IN<\/b><\/td>\n<td>Connections arriving from the internet<\/td>\n<td>Visitors opening an app on port 8443<\/td>\n<\/tr>\n<tr>\n<td><b>TCP_OUT<\/b><\/td>\n<td>Connections the server starts outwards<\/td>\n<td>Your site calling a payment service or API on a special port<\/td>\n<\/tr>\n<tr>\n<td><b>UDP_IN<\/b> and <b>UDP_OUT<\/b><\/td>\n<td>The same for UDP<\/td>\n<td>DNS on port 53<\/td>\n<\/tr>\n<tr>\n<td><b>TCP6_IN<\/b> and friends<\/td>\n<td>The same for IPv6<\/td>\n<td>If the server uses IPv6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>Second, from WHM<\/h2>\n<ol class=\"hkb-steps\">\n<li><b>Open CSF<\/b> from <b>Plugins<\/b> in WHM.<\/li>\n<li><b>Click Firewall Configuration<\/b> a long page of settings appears.<\/li>\n<li><b>Find TCP_IN<\/b> with Ctrl+F in your browser.<\/li>\n<li><b>Add the port<\/b> at the end of the list after a comma, such as <code>,8443<\/code>. For a range, use <code>30000:35000<\/code>.<\/li>\n<li><b>Save and restart<\/b> click <b>Change<\/b> at the bottom, then <b>Restart csf+lfd<\/b>.<\/li>\n<\/ol>\n<h2>Third, from the command line<\/h2>\n<figure class=\"hkb-fig\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hkb-sv-t-csfport.webp\" alt=\"TCP_IN and TCP_OUT in csf.conf and restarting CSF\" width=\"800\" height=\"451\" loading=\"lazy\" \/><\/figure>\n<p>Open the file in any editor, change the line, then run <code>csf -r<\/code>. Do not remove an existing port unless you know it is unused.<\/p>\n<h2>Ports you will see on cPanel servers<\/h2>\n<div class=\"hkb-tbl\">\n<table>\n<thead>\n<tr>\n<th>Port<\/th>\n<th>Service<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>20, 21<\/td>\n<td>FTP<\/td>\n<\/tr>\n<tr>\n<td>22<\/td>\n<td>SSH (unless changed)<\/td>\n<\/tr>\n<tr>\n<td>25, 465, 587<\/td>\n<td>SMTP mail sending<\/td>\n<\/tr>\n<tr>\n<td>110, 995<\/td>\n<td>POP3 and secure POP3<\/td>\n<\/tr>\n<tr>\n<td>143, 993<\/td>\n<td>IMAP and secure IMAP<\/td>\n<\/tr>\n<tr>\n<td>53<\/td>\n<td>DNS<\/td>\n<\/tr>\n<tr>\n<td>80, 443<\/td>\n<td>Websites<\/td>\n<\/tr>\n<tr>\n<td>2082, 2083<\/td>\n<td>cPanel<\/td>\n<\/tr>\n<tr>\n<td>2086, 2087<\/td>\n<td>WHM<\/td>\n<\/tr>\n<tr>\n<td>2095, 2096<\/td>\n<td>Webmail<\/td>\n<\/tr>\n<tr>\n<td>2077, 2078<\/td>\n<td>Web Disk<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"hkb-note warn\">Do not open database ports (3306) to the whole world. If you need an outside connection to a database, allow one address only; see <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/enable-remote-mysql\/\">remote MySQL access<\/a>.<\/div>\n<h2>Is the port really open?<\/h2>\n<ul class=\"hkb-list\">\n<li>From another machine try <code>nc -zv server-address 8443<\/code>, or an online port checker.<\/li>\n<li>Make sure something is listening: <code>ss -tlnp | grep 8443<\/code>. A port open in the firewall does not mean a service runs on it.<\/li>\n<li>If your provider has an external firewall (such as the VPS panel\u2019s), open the port there too.<\/li>\n<\/ul>\n<h2>Three things to remember<\/h2>\n<ul class=\"hkb-list\">\n<li>TCP_IN is incoming and TCP_OUT outgoing, each with its own list.<\/li>\n<li>After any change: Change, then Restart csf+lfd, or csf -r over SSH.<\/li>\n<li>An open port with nothing listening still will not answer.<\/li>\n<\/ul>\n<h2>Passive ports for FTP<\/h2>\n<p>FTP clients open a second connection for data on a random port from a set range called passive ports. If FTP connects and then hangs when listing files, that range is usually closed in the firewall. On cPanel with Pure-FTPd the default range is <code>30000:35000<\/code>, added to TCP_IN exactly like that with the colon. If you change the range in the FTP server settings, change it in CSF too.<\/p>\n<p>Before closing any port already in the list, see what uses it with <code>ss -tlnp<\/code>. Closing a running service\u2019s port cuts customers off immediately, and you may not connect the two until hours later.<\/p>\n<h2>Port questions<\/h2>\n<div class=\"hkb-faq\">\n<details>\n<summary>I changed the SSH port. What do I do in CSF?<\/summary>\n<p>Add the new port to TCP_IN before restarting SSH, and only remove 22 after logging in on the new port.<\/p>\n<\/details>\n<details>\n<summary>How do I open a port for one address only?<\/summary>\n<p>Add a line to csf.allow such as <code>tcp|in|d=3306|s=203.0.113.5<\/code>, then restart CSF.<\/p>\n<\/details>\n<details>\n<summary>I opened the port and it still does not work<\/summary>\n<p>Check that a service is listening, check your provider\u2019s external firewall, and make sure you restarted CSF after saving.<\/p>\n<\/details>\n<details>\n<summary>Should I close the unencrypted ports 2082 and 2086?<\/summary>\n<p>If everyone logs in through the encrypted 2083 and 2087, closing them reduces the attack surface, but check nobody depends on them first.<\/p>\n<\/details>\n<\/div>\n<div class=\"hkb-rel\"><b>Related guides<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/csf-firewall-whm\/\">The CSF Firewall on a cPanel Server: What It Does, Installing It from Manage Plugins, and the First Settings<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/important-csf-firewall-commands-via-ssh\/\">Important CSF firewall commands via SSH<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/enable-remote-mysql\/\">How to Enable Remote MySQL Connections in WHM and cPanel<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/vps-firewall-manage-open-ports\/\">Firewall: Control the Open Ports on Your VPS<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.hyyat.com\/en\/kb\/whm-cpanel-control-panels\/\">All WHM guides \u2192<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In two linesIn WHM, then Plugins, then ConfigServer Security &amp; Firewall click Firewall Configuration, add the port number to TCP_IN for incoming connections (or TCP_OUT for outgoing), comma separated, then click Change and Restart csf+lfd. The situation: A developer has installed an app on port 8443, or a site needs to reach an external service [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":21229,"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":[],"class_list":["post-18360","docs","type-docs","status-publish","has-post-thumbnail","hentry","doc_category-whm-cpanel-control-panels"],"year_month":"2026-11","word_count":651,"total_views":"6","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","term_url":"https:\/\/www.hyyat.com\/en\/kb\/whm-cpanel-control-panels\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18360","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=18360"}],"version-history":[{"count":0,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18360\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media\/21229"}],"wp:attachment":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media?parent=18360"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_category?post=18360"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_tag?post=18360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}