3

I'm trying to use the net-ssh documentation to connect to a remote server. I'm using the following options:

  • :username
  • :port
  • :keys
  • :host

with values set equal to the values of the Host that I have configured in my ~/.ssh/config file that I use for connecting to the same remote server using the ssh command. However, I'm getting an error when trying to run the following line in irb:

session = Net::SSH.start( # my options here # )

Error:

Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout
    from /Users/jake/.gem/gems/net-ssh-4.2.0/lib/net/ssh/transport/session.rb:90:in `rescue in initialize'
    from /Users/jake/.gem/gems/net-ssh-4.2.0/lib/net/ssh/transport/session.rb:57:in `initialize'
    from /Users/jake/.gem/gems/net-ssh-4.2.0/lib/net/ssh.rb:237:in `new'
    from /Users/jake/.gem/gems/net-ssh-4.2.0/lib/net/ssh.rb:237:in `start'
    from (irb):14
    from /usr/local/bin/irb:11:in `<main>'

Is this a configuration/argument error on my part or do I need to call a different command?

gr1zzly be4r
  • 2,072
  • 1
  • 18
  • 33

1 Answers1

2

My issue was that I was specifying my arguments incorrectly. If you're using options, you need to specify your host and username as position arguments and then you can use hashes for the rest of the arguments. Doing:

Net::SSH.start('host', 'user', :port => #my port#, :keys => ['/path/to/key'])

worked for me.

gr1zzly be4r
  • 2,072
  • 1
  • 18
  • 33