Fix FTP over TLS errors on Ubuntu in CyberPanel
FTP or File Transfer Protocol is used to transfer files to servers or your website from your own computers, mobiles or other servers. It’s as old as the internet itself, however, we live in a world full of cybersecurity issues.
In order to ensure that your credentials aren’t snooped by malicious actors during authentication, CyberPanel uses FTP over TLS which provides encryption to authentication mechanism and file transfer.
This is the default option and CyberPanel uses automatic upgrading from FTP to FTP over TLS by using passive ports in the range of 40110-40210
However, sometimes the passive ports aren’t open or the configuration is missing which causes errors like these
Error: GnuTLS error -110 in gnutls_record_recv: The TLS connection was non-properly terminated. Status: Server did not properly shut down TLS connection Error: Could not read from socket: ECONNABORTED - Connection aborted Error: Could not connect to server
Status: Retrieving directory listing... Command: PWD Response: 257 "/" is your current location Command: TYPE I Response: 200 TYPE is now 8-bit binary Command: PASV Response: 227 Entering Passive Mode (37,139,17,170,252,238) Command: MLSD Error: Connection timed out after 20 seconds of inactivity Error: Failed to retrieve directory listing
The issue has been fixed at the code level however if you are using an older version of CyberPanel ( which should be updated anyway) or a marketplace image of CyberPanel on Ubuntu 18.04 the issue can be fixed by running the following commands in your terminal
- Open the passive ports
- Download updated version of PureFtpD
- Install the latest version
- Restart the FTP server
echo "40110 40210" > /etc/pure-ftpd/conf/PassivePortRange wget http://mirrors.kernel.org/ubuntu/pool/universe/p/pure-ftpd/pure-ftpd-common_1.0.47-3_all.deb wget http://mirrors.kernel.org/ubuntu/pool/universe/p/pure-ftpd/pure-ftpd-mysql_1.0.47-3_amd64.deb dpkg --install --force-confold pure-ftpd-common_1.0.47-3_all.deb dpkg --install --force-confold pure-ftpd-mysql_1.0.47-3_amd64.deb systemctl restart pure-ftpd-mysql.service'
Voila, the issue will be fixed and you will be able to transfer your files with a peace of mind and sense of security