0
HY 我嘗試用Ruby腳本在新的服務器連接ssh連接
> 1.9.2p320 :038 > Net::SSH.start('192.168.10.80', 'root', :password => 'xxxxx')
> Net::SSH::AuthenticationFailed: root
> from /home/zyriuse/.rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.7.0/lib/net/ssh.rb:215:in > `start'
> from (irb):38
> from /home/zyriuse/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
我不明白爲什麼我得到這個錯誤,因爲當我嘗試手動一切它的工作
我嘗試了很多事情
require 'net/ssh'
require 'logger'
Net::SSH.start(
'localhost', 'zyriuse',
:keys => [ "~/.ssh/id_dsa.pub" ],
) do |session|
puts "hello "
end
〜
zyriuse(淨:: SSH :: AuthenticationFailed)
Net::SSH.start('host',
:password=>'passord',
:port=>22,
:username=>'zyriuse',
...) do |session|
puts "hello wordl"
end
'開始':淨:: SSH :: AuthenticationFailed
我不明白爲什麼我得到所有的時間相同的錯誤
不公開您的實際密碼。 – karthikr
當你手動執行'ssh'時,你是以'root'身份登錄還是你在'ssh'請求中使用'roogt @ 192.168.10.80'? – lurker
所以......它在軌道上失敗,但不是紅寶石?這裏「非手動」是什麼意思?它們運行的用戶是什麼? – rogerdpack