Ssh tunnel using Net::SSH

using putty i connect to myserver1.com:22 with myuser and mypwd
when i am connected then i perform this:
ssh myserver2.com
and i supplied mypwd
then i am finally ssh connected to myserver2.com

I am trying to do the same using Net::SSH using the proxy command but i
get always this message:

require ‘net/ssh’
require ‘net/ssh/proxy/command’

proxy = Net::SSH::Proxy::Command.new(‘ssh myserver1.com -W %h:%p’)

Net::SSH.start('myserver2.com, ‘myuser’, :password=>“mypwd”, :proxy =>
proxy) do |my_ssh|
my_ssh.open_channel do |channel|
channel.exec(“ls”)
end
end

and i get this message:
C:/Ruby22/lib/ruby/gems/2.2.0/gems/net-ssh-3.2.0/lib/net/ssh/proxy/command.rb:67:in
`rescue in open’: No such file or directory - ssh myserver1.com -W
myserver2.com:22

any idea how to do it?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs