if a username and password are required, use this code:
require 'net/ftp' ftp = Net::FTP.new('ftp.ruby-lang.org') ftp.passive = true ftp.login(username, password) ftp.list('*') { |file| puts file } ftp.close