Search code examples
javasslapache-commons-netftps

What is execProt("P") in Apache Commons net?


I have setup an FTPS server on my aws ec2 instance. I am using Apache Commons net to connect programmatically to my server.

try
{
    ftps.enterLocalPassiveMode();
    ftps.setBufferSize(1000);
    ftps.execPROT("P");

    if (!ftps.login(username, password))
    {
        ftps.logout();
        error = true;
        break __main;
    }
}

I cannot retrieve files if I don't set execProt("P"). From their documentation, I see that "P" stands for Private Data Channel Protection Level. What does this mean? Why am I using P instead of "S" or "E"?


Solution

  • The PROT command in ftps can have the values P and C. P stands for private and means that the data connection is encrypted with TLS. C stands for clear and means that the data connection is not encrypted. The values of E (confidential) and S (safe) are defined too but in practice not implemented in FTP servers. For more details see the specification, i.e. RFC 4217.