port-forward中的net-ssh前向端口

时间:2014-06-09 20:39:06

标签: ssh portforwarding net-ssh

所以我试图在已转发的会话中转发端口。这是代码:

require 'net/ssh'


Net::SSH.start(
  '1.2.3.4', 'username',
  :host_key => "ssh-rsa",
  :keys => [ "/Users/awesomesauce/.ssh/coolness.pem" ],
) do |session|
  session.forward.remote(8080, "localhost", 8081)
  # Heres where I want to forward over the 'session'
  # session.forward.remote(8081, "some.other.host", 80)
  session.loop { true }
end

有什么想法吗?

0 个答案:

没有答案