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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.