0
/usr/local/lib/ruby/gems/1.9.1/gems/net-ssh-2.0.23/lib/net/ssh.rb:192:in
`start': Net::SSH::AuthenticationFailed (Net::SSH::AuthenticationFailed)
我真的不明白這是怎麼回事..?我已經完成了我的研究並發現了this,但它並沒有真正回答我的問題。
是否有認證失敗的具體原因?我正在做的是ssh
對不同的服務器,有什麼具體的我需要改變?
來源:
require 'rubygems'
require 'net/ssh'
require 'etc'
print "Enter password: "
system "stty -echo"
@password = gets.chomp
system "stty echo"
def logged_in(server)
cmd = `who`.gsub(/[ \t].*/,"").gsub(/\A.*\n/,'')
check = Net::SSH.start(@host, @username, :password => @password) do |ssh|
ssh.exec!(cmd)
end
end
@host = %w(server_names_here) do |server|
logged_in(server)
end
@username = Etc.getlogin
我想這可能是錯誤的密碼,所以我嘗試進入以「上」,我輸入正確的密碼回聲的密碼,我也想,也許這不是拉着我的用戶名所以我用:@username = 'my_username'
我仍然收到同樣的錯誤
編輯: 發現了問題,它與在@username
放在做
錯誤密碼? – Jakuje
@Jakuje哈哈,我剛剛編輯了關於這個細節的問題 – Bam