net ssh - Net::SSH.start Timeout connecting to Vagrant host in Ruby -


i have vagrant vm running.

vagrant init centos/7 

generates minimal vagrantfile:

vagrant.configure(2) |config|   config.vm.box = "centos/7" end 

vagrant ssh-config reports following:

host default   hostname 127.0.0.1   user vagrant   port 2222   userknownhostsfile /dev/null   stricthostkeychecking no   passwordauthentication no   identityfile "/path/to/.vagrant/machines/default/virtualbox/private_key"   identitiesonly yes   loglevel fatal 

however, following seems fail:

require 'net/ssh' net::ssh.start("127.0.0.1", "vagrant", {     :auth_methods => [         "publickey",         "password"     ],     :port=>"2222",     :keys => [         "/path/to/.vagrant/machines/default/virtualbox/private_key"     ] }) 

with following:

net::ssh::connectiontimeout: net::ssh::connectiontimeout     /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/session.rb:90:in `rescue in initialize'     /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/session.rb:57:in `initialize'     /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh.rb:233:in `new'     /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh.rb:233:in `start'     (irb):2     /usr/local/bin/irb:11:in `<main>' 

i can connect using ssh, expected:

ssh -p 2222 -i /path/to/.vagrant/machines/default/virtualbox/private_key vagrant@127.0.0.1 

how can connect vagrant host in ruby on local machine?


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -