If you’re unlucky enough to have to connect to an FTPS server (SFTP ends up being much easier), the Double Bag FTPS gem makes things much easier.

A few finer points to note:

  • “verify_mode: OpenSSL::SSL::VERIFY_NONE” makes your life easier in development mode – not to mention some FTPS sites won’t even have one
  • Most servers don’t like active mode, so explicitly use passive mode. Your connection ends up hanging without it.

So usage is:

DoubleBagFTPS.open(host, user, password, nil, DoubleBagFTPS::EXPLICIT, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |ftps|
 ftps.passive = true
 ftps.put("myfile.txt", filename)