0
當我試圖Net :: SSH.start到我的debian ssh服務器並傳輸文件時,每當我有一個非常奇怪的錯誤消息 - 「開始」:Net :: SSH: :AuthenticationFailed,但所有的認證數據都是正確的,我不知道是什麼問題。有沒有人面臨同樣的問題? 代碼寫在紅寶石和淨/ SSH模塊都在使用,這裏是一個代碼:AuthenticationFailed net-ssh ruby
require 'rubygems'
require 'net/ssh'
def copy_file(session, source_path, destination_path=nil)
destination_path ||= source_path
cmd = %{cat > "#{destination_path.gsub('"', '\"')}"}
session.process.popen3(cmd) do |i, o, e|
puts "Copying #{source_path} to #{destination_path}... "
open(source_path) { |f| i.write(f.read) }
puts 'Done.'
end
end
Net::SSH.start("192.168.112.129",
:username=>'username',
:password=>'password') do |session|
copy_file(session, 'D:/test/1.txt')
copy_file(session, '/home/timur/Documents/new_file.rb"')
end
仍然是一樣的錯誤信息 – 2013-03-11 14:23:23