停止 ssh 隧道(停止监听端口而不杀死进程)

Yan*_*ang 3 ssh openssh tunnel ssh-tunnel

在 ssh 会话中,可以通过击键~C和输入 (eg)来启动隧道-L80:localhost:80。但是,有什么方法可以停止该端口上的隧道(除了终止进程)?

jjl*_*lin 5

摘自 ssh(1) 联机帮助页:

 ~C      Open command line.  Currently this allows the addition of port
         forwardings using the -L, -R and -D options (see above).  It also
         allows the cancellation of existing port-forwardings with
         -KL[bind_address:]port for local, -KR[bind_address:]port for
         remote and -KD[bind_address:]port for dynamic port-forwardings.
Run Code Online (Sandbox Code Playgroud)

因此,在您的示例中,~C其次是-KL80取消端口转发。