[英]ssh connection over ruby script
hy i try to connect in the new server by ruby script 我尝试通过ruby脚本连接新服务器
> 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>'
i dont understand why i get this error because when i try manually everything it's working 我不明白为什么会收到此错误,因为当我手动尝试所有操作时
i try a lot of thing 我尝试了很多事情
require 'net/ssh'
require 'logger'
Net::SSH.start(
'localhost', 'zyriuse',
:keys => [ "~/.ssh/id_dsa.pub" ],
) do |session|
puts "hello "
end
~ 〜
zyriuse (Net::SSH::AuthenticationFailed) zyriuse(Net :: SSH :: AuthenticationFailed)
Net::SSH.start( 'host',
:password=>'passord',
:port=>22,
:username=>'zyriuse',
... ) do |session|
puts "hello wordl"
end
`start': Net::SSH::AuthenticationFailed '开始':Net :: SSH :: AuthenticationFailed
i dont understand why i get all the time the same error 我不明白为什么我总是会出现相同的错误
Make sure: 确保:
ssh root@192.168.10.80
works from your machine, typing the password ssh root@192.168.10.80
在您的机器上ssh root@192.168.10.80
工作,输入密码 The error AuthenticationFailed
means just that. 错误
AuthenticationFailed
就是这个意思。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.