{"id":756,"date":"2021-07-04T06:30:55","date_gmt":"2021-07-04T06:30:55","guid":{"rendered":"http:\/\/www.webhostingchennai.co.in\/blog\/?p=756"},"modified":"2021-07-18T05:52:43","modified_gmt":"2021-07-18T05:52:43","slug":"configuring-ftp-passive-ports-range","status":"publish","type":"post","link":"https:\/\/bestunixhosting.in\/blog\/configuring-ftp-passive-ports-range\/","title":{"rendered":"Configuring FTP Passive ports range in cPanel"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_69_1 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/bestunixhosting.in\/blog\/configuring-ftp-passive-ports-range\/#Configuring_FTP_Passive_ports_range_in_cPanel\" title=\"Configuring FTP Passive ports range in cPanel\">Configuring FTP Passive ports range in cPanel<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/bestunixhosting.in\/blog\/configuring-ftp-passive-ports-range\/#How_to_Enable_the_passive_port_range_for_Pure-FTPd\" title=\"How to Enable the passive port range for Pure-FTPd\">How to Enable the passive port range for Pure-FTPd<\/a><\/li><\/ul><\/nav><\/div>\n<h4><span class=\"ez-toc-section\" id=\"Configuring_FTP_Passive_ports_range_in_cPanel\"><\/span>Configuring FTP Passive ports range in cPanel<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>FTP uses two ports, a data port and a command port, to transfer information between a client and a server. During a typical active mode session, the command port uses port 21 and the data port uses port 20. When you use a passive mode, however, the data port does not always use port 20.<\/p>\n<p>Let see about, what is\u00a0 Active FTP and what is Passive FTP ?<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>ACTIVE FTP<\/strong><\/span><\/p>\n<p>In <em>active<\/em> mode, the FTP server responds to the connection attempt and returns a connection request from a different port to the FTP client. Network Address Translation (NAT) configurations block this connection request.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-757 size-full\" src=\"https:\/\/i0.wp.com\/www.webhostingchennai.co.in\/blog\/wp-content\/uploads\/2018\/03\/Active-FTP.jpg?resize=393%2C172\" alt=\"Configuring FTP Passive ports range\" width=\"393\" height=\"172\" \/><\/p>\n<p>In the above figure, a user connects from a random port on a file transfer client to port 21 on the server. It sends the PORT command, specifying what client-side port the server should connect to. This port will be used later on for the data channel and is different from the port used in this step for the command channel.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-758 size-full\" src=\"https:\/\/i0.wp.com\/www.webhostingchennai.co.in\/blog\/wp-content\/uploads\/2018\/03\/active-FTPfirewall.jpg?resize=431%2C241\" alt=\"Configuring FTP Passive ports range\" width=\"431\" height=\"241\" \/><\/p>\n<p>In the above figure, the server connects from port 20 to the client port designated for the data channel. Once connection is established, file transfers are then made through these client and server ports.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">PASSIVE FTP<\/span><\/strong><\/p>\n<p>In <em>passive<\/em> mode, the FTP client initiates both connection attempts. NAT configurations do <strong>not<\/strong> block this connection request.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/i0.wp.com\/www.webhostingchennai.co.in\/blog\/wp-content\/uploads\/2018\/03\/passiveFTP.jpg\" target=\"_blank\" rel=\"noopener\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-759 size-full\" src=\"https:\/\/i0.wp.com\/www.webhostingchennai.co.in\/blog\/wp-content\/uploads\/2018\/03\/passiveFTP.jpg?resize=432%2C232\" alt=\"Configuring FTP Passive ports range\" width=\"432\" height=\"232\" \/><\/a><\/p>\n<p>In the above figure, the client connects from a random port to port 21 on the server and issues the PASV command. The server replies, indicating which (random) port it has opened for data transfer.The client connects from another random port to the random port specified in the server\u2019s response. Once connection is established, data transfers are made through these client and server ports.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"How_to_Enable_the_passive_port_range_for_Pure-FTPd\"><\/span><strong>How to Enable the passive port range for Pure-FTPd<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Login to your server <a href=\"https:\/\/www.webhostingchennai.co.in\/blog\/change-ssh-port\/\" target=\"_blank\" rel=\"noopener\">SSH<\/a> with root, edit the pure-FTPd configuration file with below command and search for &#8220;PassivePortRange&#8221;<\/p>\n<pre>[root@webchennai ~]# nano \/etc\/pure-ftpd.conf\r\n\r\n. . . .\r\n# Port range for passive connections replies. - for firewalling.\r\nPassivePortRange 30000 45000\r\n. . . .\r\n<\/pre>\n<p>Modify it as above, save the configuration file and restart the service<\/p>\n<pre>[root@webchennai ~]# service pure-ftpd restart<\/pre>\n<p>Note : Changes made directly to the <code>\/etc\/pure-ftpd.conf<\/code> file will be overwritten any time the configuration file is rebuilt, which could happen during updates. Changes made to the template file will be applied when the configuration file is rebuilt, so you will want to modify that so your changes are added if the file is rebuilt.<\/p>\n<p>Modify the template file with below command.<\/p>\n<pre>[root@webchennai ~]# nano \/var\/cpanel\/conf\/pureftpd\/main\r\n\r\n. . . .\r\n. . . .\r\nMaxLoad: 4\r\nMinUID: 100\r\nNoAnonymous: 'yes'\r\nPassivePortRange: 30000 45000\r\nProhibitDotFilesRead: 'no'\r\nProhibitDotFilesWrite: 'no'\r\n\r\n. . . . .\r\n<\/pre>\n<p>After modifying that, you can run this command to rebuild the ftp configuration file with your changes, then restart ftp.<\/p>\n<pre>[root@webchennai ~]# \/usr\/local\/cpanel\/bin\/build_ftp_conf\r\n[root@webchennai ~]# \/scripts\/restartsrv_ftpd<\/pre>\n<p>Now, you can able to connect FTP with Passive mode.<\/p>\n<p>Note : Make sure you have configured this passive port range in your <a href=\"https:\/\/configserver.com\/cp\/csf.html\" target=\"_blank\" rel=\"noopener\">CSF<\/a>, to add this port range in csf use the below command.<\/p>\n<pre>[root@webhostingchennai ~]# nano \/etc\/csf\/csf.conf\r\n\r\n# Allow incoming TCP ports\r\nTCP_IN=\"20,21,22,25,53,80,110,143,443,465,587,2082,2083,2086,2087,2095,2096,30000:45000\"\r\n\r\n# Allow outgoing TCP ports\r\nTCP_OUT = \"20,21,22,25,37,43,53,80,110,113,443,587,873,993,995,2086,2087,2089,2703,30000:45000\"<\/pre>\n<p>Include the Passive Port range and reload the csf<\/p>\n<pre>[root@webchennai ~]# csf -r<\/pre>\n<p>Hope this article helps you, please share your comments to improve better.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Configuring FTP Passive ports range in cPanel FTP uses two ports, a data port and a command port, to transfer information between a client and a server. During a typical active mode session, the command port uses port 21 and the data port uses port 20. When you use a passive mode, however, the data [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1202,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[31,23,29],"tags":[30,32],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/bestunixhosting.in\/blog\/wp-content\/uploads\/2021\/07\/FTP-passive.jpg?fit=789%2C260&ssl=1","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/posts\/756"}],"collection":[{"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=756"}],"version-history":[{"count":1,"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/posts\/756\/revisions"}],"predecessor-version":[{"id":779,"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/posts\/756\/revisions\/779"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bestunixhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}