开发者

Net::SSH fails to connect

开发者 https://www.devze.com 2023-02-24 07:06 出处:网络
I\'ve written a ruby script to do some work on a remote host. Running it from a Mac with 10.6. The IP works fine with a manual ssh -l devacct 10.10.10.10, but as you can see it fails in the script.

I've written a ruby script to do some work on a remote host. Running it from a Mac with 10.6. The IP works fine with a manual ssh -l devacct 10.10.10.10, but as you can see it fails in the script.

require 'rubygems'
require 'net/ssh'

Net::SSH.start("10.10.10.10", "devacct", :password => "password1") do |ssh|
end

Fails horribly with:

/Library/Ruby/Gems开发者_Python百科/1.8/gems/net-ssh-2.1.4/lib/net/ssh/transport/session.rb:65:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError)

Any ideas? :)

Kind Regards


Normaly this exception is thrown if the hostname can't be resolved. Make sure the ip adress you try to connect to is correct and reachable.

0

精彩评论

暂无评论...
验证码 换一张
取 消