Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
net ssh转发端口在转发端口中_Ssh_Portforwarding_Net Ssh - Fatal编程技术网

net ssh转发端口在转发端口中

net ssh转发端口在转发端口中,ssh,portforwarding,net-ssh,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 w

因此,我试图在已转发的会话中转发端口。代码如下:

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

有什么想法吗?

您对该代码有什么问题?什么是不应该发生的?它在第二次调用时引发异常。我需要使用session变量在子会话中启动一个新的转发。