Net SSh Gem,Start方法产生连接超时错误

时间:2014-02-14 09:05:22

标签: ruby-on-rails ruby net-ssh

在我的项目中,我正在通过ssh测试与远程Windows 2008服务器的连接。我总是收到以下错误:

Errno::ETIMEDOUT: Connection timed out - connect(2)
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `initialize'
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `open'
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `block in initialize'
  from /home/kamesh/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
  from /home/kamesh/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/timeout.rb:97:in `timeout'
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:67:in `initialize'
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh.rb:200:in `new'
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh.rb:200:in `start'
  from /home/kamesh/projects/RubyApp/lib/connections/ssh_connection.rb:9:in `connect'
  from (irb):5
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands/console.rb:90:in `start'
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in `start'
  from /home/kamesh/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:62:in `<top (required)>'
  from bin/rails:4:in `require'
  from bin/rails:4:in `<main>'

1 个答案:

答案 0 :(得分:0)

为了确保,我们所说的是同一件事 - 这里是Net::SSH GitHub page的链接。

根据您的错误消息,您的ssh客户端无法连接到其他主机上的ssh服务器。

首先,您需要确保服务器正在运行服务器。这是关于如何在Windows Server 2008上安装它的guide

其次,您需要尝试ping您的服务器,以确保它是否可以通过您的网络访问。

如果前一阶段没有任何问题,您可以尝试再次使用Net :: SSH。