TL;DR: Configuring vsftp is a difficult work and we always meet various of errors. In this post, I am going to introduce one possible solution of error "GnuTLS error -15: An unexpected TLS packet was received." when you are using vsftpd. After finished configuration of vsftpd, we are trying to connect to the ftp server, and then, an error seems as follow:
Status: Connection established, waiting for welcome message... Status: Initializing TLS... Status: Verifying certificate... Status: TLS connection established. Command: USER my_ftp_user Response: 331 Please specify the password. Command: PASS ************ Error: GnuTLS error -15: An unexpected TLS packet was received. Error: Could not connect to server Status: Waiting to retry...
It seems like an error in SSL/TLS, but sometimes it isn't.
Firstly, we may check the configuration of SSL/TLS.
Here is a sample of my configuration , you may check your configruation, and make sure your SSL configuration is correct.
And then, we may comment the lines for SSL temporary, and try to connect again.
As for me, the error message has been changed as follow:
Command: USER my_ftp_user Response: 331 Please specify the password. Command: PASS ************ Response: 500 OOPS: vsftpd: refusing to run with writable root inside chroot() Error: Critical error: Could not connect to server
It is pretty easy to find a solution here , which is adding another line:
Actually, I am just supposed to provide an approach in debugging, if we are meeting some errors similar to "GnuTLS error -15: An unexpected TLS packet was received.", This situation may just tell us one unexpected message comes (always error message), instead of normal TLS package. Temporarily close the SSL may make everything easy.
---- Updated -----
According to this QA you may required to update configure file as follow if you are using ubuntu...