6

I am using FTP over implicit SSL to upload some files. I encountered the following error message

[Command]  PWD
[Response]  257 "/" is current directory.
[Command]  PWD
[Response]  257 "/" is current directory.
[Command]  TYPE A
[Response]  200 Type set to A
[Command]  PWD
[Response]  257 "/" is current directory.
[Command]  PASV
[Response]  227 Entering Passive Mode (10,0,0,19,195,113)
[Command]  LIST -aL
[Response]  521 PROT P required
[Command]  PWD
[Response]  257 "/" is current directory.
[Command]  PASV
[Response]  227 Entering Passive Mode (10,0,0,19,195,114)
[Command]  LIST -aL
[Response]  521 PROT P required
[Status] Failed::FTP protocol error. 521 PROT P required.

May I know what is this error message "521 PROT P required" saying?

Thanks

alexcctan
  • 123
  • 1
  • 2
  • 8

2 Answers2

16

type the following: set ftp:ssl-protect-data true

  • 3
    This fixes the "mirror: Access failed: 521 Data connection cannot be opened with this PROT setting." error when using -Parallel setting. – IT-Dan Sep 09 '16 at 09:26
  • 2
    If you are using `lftp`, put that command into your `.lftp/rc` file. – Yitz Oct 10 '18 at 17:59
4

Before starting a data transfer (e.g. creating a new data connection outside the control connection to transfer files or listing) you have to specify the protection level using the PROT command. The main protection levels are P for protected (e.g. SSL encryption) or C for clear (no encryption). The server complains, because you don't specify a protection level and so it does not know how you want to get your data.

The PROT command must be implemented and used by all ftps clients.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • That explains what caused the problem, but not how to fix it. For that, see the answer of @Edgardo. – Yitz Oct 10 '18 at 18:01
  • 2
    @Yitz: The question clearly was *"May I know what is this error message "521 PROT P required" saying?"*, i.e. it asks what the message means and not how to fix the problem. Moreover, the OP did not even specify which FTP client he was using and the answer you refer to assumes a specific client. – Steffen Ullrich Oct 10 '18 at 18:17
  • I think it's quite clear that the reason most people want to understand what an error message means is because they want to fix the problem. That's certainly the reason I landed here. So I was pleased to find both your fine answer and Edgardo's. You're right that Edgardo's solution is for a specific client - luckily for me, it was the one I needed. I tried to help clarify that in my comment to Edgardo's answer. – Yitz Oct 11 '18 at 21:15
  • 2
    @Yitz: I'm happy that Edgardo figured out two years after the question was asked and answered that the OP might have used lftp (OP did not say what client was used) and showed how the problem could be fixed with lftp. Still, the OP accepted the answer and did not even ask how to fix the problem so I assume that he was satisfied with the information he got. – Steffen Ullrich Oct 11 '18 at 21:21