Mirror318
Mirror318

Reputation: 12683

Rails Net::SFTP connection timeout

I'm trying a command from the docs for Net::SFTP (https://github.com/net-ssh/net-sftp), here is my code:

Net::SFTP.start(*sftp_credentials) { |sftp| 
  sftp.dir.foreach("/") { |entry| 
    puts entry.longname
  }
}

And this is the response I get:

Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout
    from /Users/regan/.rvm/gems/ruby-2.3.3@scotpac/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:92:in `rescue in initialize'
    from /Users/regan/.rvm/gems/ruby-2.3.3@scotpac/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:60:in `initialize'
    from /Users/regan/.rvm/gems/ruby-2.3.3@scotpac/gems/net-ssh-5.0.2/lib/net/ssh.rb:242:in `new'
    from /Users/regan/.rvm/gems/ruby-2.3.3@scotpac/gems/net-ssh-5.0.2/lib/net/ssh.rb:242:in `start'
    from /Users/regan/.rvm/gems/ruby-2.3.3@scotpac/gems/net-sftp-2.1.2/lib/net/sftp.rb:31:in `start'

Any ideas on what's going wrong?

Upvotes: 0

Views: 1562

Answers (1)

Mirror318
Mirror318

Reputation: 12683

Turns out the server I was trying to connect to had a firewall for which I wasn't whitelisted.

Upvotes: 0

Related Questions