On Sep 17, 2010, at 2:02 PM, Jy Lecour wrote:

> I needed to download a file from a FTP server, with OpenURI and I've found that it is not possible to do it with authentication.
> 
> There is an option in the OpenURI open method to use a username/password but it is not used in FTP connection, the username/password for FTP is always set to anonymous/_nil_.

OpenURI is just a wrapper around some clever URI parsing and URI seems to support it just fine:

>> require "uri"
=> true
>> u = URI.parse("http://user:pass / server.com/")
=> #<URI::HTTP:0x1007180f8 URL:http://user:pass / server.com/>
>> u.userinfo
=> "user:pass"
>> u.host
=> "server.com"
>> u = URI.parse("ftp://user:pass / server.com/")
=> #<URI::FTP:0x10070e2b0 URL:ftp://user:pass / server.com/>
>> u.userinfo
=> "user:pass"
>> u.host
=> "server.com"

Just add it to the server URL and I think you are all set.