Set the mode to passive
require 'net/ftp' ftp = Net::FTP.new('ftp.ruby-lang.org') ftp.passive = true ftp.login(username, password) ftp.delete(filename) ftp.list('*') { |file| puts file } ftp.close