Fix FTP over TLS errors on Ubuntu in CyberPanel

You are here:
< Back

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

Or

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

 

    1. Open the passive ports
    2. Download updated version of PureFtpD
    3. Install the latest version
    4. 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

 

Author's page
Muttahir Syed

Muttahir is a passionate developer and a DevOps engineer who loves to help others by documenting tech. At CyberPanel, he works as DevOps support and documents new changes

Comments

  • MIke March 26, 2020 at 3:53 pm

    Hey thanks for the fix.

    There are some minor typos as the commands have ‘ on the end which causes an error when copied and pasted as noted above.

    this:
    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’

    Should be like:
    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

    Full set of the commands looks like this:
    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

    Reply
Leave a Reply