{"id":377,"date":"2020-10-03T03:00:22","date_gmt":"2020-10-03T03:00:22","guid":{"rendered":"https:\/\/dft.wiki\/?p=377"},"modified":"2026-06-09T14:35:46","modified_gmt":"2026-06-09T18:35:46","slug":"proftpd-tls-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=377","title":{"rendered":"ProFTPd + SSL\/TLS on Ubuntu"},"content":{"rendered":"<p>Having access to your files through FTP is very convenient and reliable.<\/p>\n<p>FTP has some great applications for backups and supports resuming interrupted downloads or uploads of large files.<\/p>\n<p>The problem is that FTP is a plain text protocol, so it is strongly recommended to add another layer of security.<\/p>\n<p>One option is configuring your firewall to accept FTP connections only from your local network or VPN.<\/p>\n<pre>sudo ufw allow from 10.0.0.0\/24 to any port 21<\/pre>\n<p>In this case, I am allowing access to the entire 10.0.0.0 network (from 10.0.0.1 to 10.0.0.254) on port 21 (the default FTP port).<\/p>\n<p>Another option is to use the same SSL\/TLS certificate you may have already created for your HTTP server [<a href=\"https:\/\/dft.wiki\/?p=233\">Read It<\/a>].<\/p>\n<p>I also found that ProFTPd does not work well with Fail2Ban [<a href=\"https:\/\/dft.wiki\/?p=401\">Read It<\/a>], so I prefer to use Ubuntu&#8217;s native FTP server, VSFTPD [<a href=\"https:\/\/dft.wiki\/?p=500\">Read It<\/a>].<\/p>\n<p>Assuming your FTP server is ProFTPd and it is already up and running, let&#8217;s add encryption.<\/p>\n<pre>sudo nano \/etc\/proftpd\/tls.conf<\/pre>\n<p>Find the following lines and add the path to your SSL\/TLS certificate:<\/p>\n<pre>TLSEngine          <strong>on<\/strong>\r\nTLSProtocol          <strong>TLSv1.2<\/strong>\r\n\r\nTLSRSACertificateFile \/etc\/apache2\/md\/domains\/<strong>domain.com<\/strong>\/pubcert.pem\r\nTLSRSACertificateKeyFile \/etc\/apache2\/md\/domains\/<strong>domain.com<\/strong>\/privkey.pem<\/pre>\n<p><strong>Note:<\/strong> this tutorial assumes the server already has a certificate issued by Let&#8217;s Encrypt using Apache&#8217;s MD module. If it was generated a different way, locate these files on your system or obtain them. The paths above are likely correct and you may only need to update the domain name.<\/p>\n<p>Confirm that your certificate files exist, then update the domain name.<\/p>\n<pre>TLSOptions NoCertRequest EnableDiags <strong>NoSessionReuseRequired<\/strong><\/pre>\n<p>Uncomment the line ending with &#8220;NoSessionReuseRequired&#8221;. It is not strictly required, but my FTP client (FileZilla) was unable to connect without it since it does not reuse sessions.<\/p>\n<p>Also uncomment this line to enforce encrypted connections only:<\/p>\n<pre>TLSRequired          <strong>on<\/strong><\/pre>\n<p>Edit the main configuration file:<\/p>\n<pre>sudo nano \/etc\/proftpd\/proftpd.conf<\/pre>\n<p>Uncomment the following line:<\/p>\n<pre>Include          <strong>\/etc\/proftpd\/tls.conf<\/strong><\/pre>\n<p>Check the passive port range you need to open in your firewall:<\/p>\n<pre>PassivePorts          <strong>40000          50000<\/strong><\/pre>\n<p>In my case, I reduced this to only 500 ports, down from the original range.<\/p>\n<p>Create the firewall rules:<\/p>\n<pre>sudo ufw allow <strong>21<\/strong>\r\nsudo ufw allow <strong>40000:50000<\/strong>\/tcp<\/pre>\n<p>Restart the server and test a remote connection:<\/p>\n<pre>sudo systemctl restart proftpd<\/pre>\n<p>If the connection fails, check the log file to troubleshoot:<\/p>\n<pre>sudo tail -n 20 \/var\/log\/proftpd\/tls.log<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Having access to your files through FTP is very convenient and reliable. FTP has some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-377","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=377"}],"version-history":[{"count":11,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/377\/revisions"}],"predecessor-version":[{"id":5829,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/377\/revisions\/5829"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}