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.
精彩评论