Ruby on Rails and FTPS

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:, user, password, nil, DoubleBagFTPS::EXPLICIT, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |ftps|
 ftps.passive = true
 ftps.put("myfile.txt", filename)


  1. thank you for this!

    just started using this gem and was getting the following error when trying to upload a file:

    C:/Ruby193/lib/ruby/1.9.1/net/ftp.rb:300:in `getresp’: 501 Server cannot accept argument. (Net::FTPPermError)

    setting the mode to passive did the trick!

Leave a Reply

Your email address will not be published. Required fields are marked *