简体   繁体   English

Net :: SSH无法连接

[英]Net::SSH fails to connect

I've written a ruby script to do some work on a remote host. 我编写了一个ruby脚本来在远程主机上做一些工作。 Running it from a Mac with 10.6. 从装有10.6的Mac上运行。 The IP works fine with a manual ssh -l devacct 10.10.10.10, but as you can see it fails in the script. 该IP与手动ssh -l devacct 10.10.10.10可以正常工作,但是如您所见,它在脚本中失败。

require 'rubygems'
require 'net/ssh'

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

Fails horribly with: 严重失败:

/Library/Ruby/Gems/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. 确保您尝试连接的IP地址正确且可访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM