![停止 ssh 隧道(停止监听端口而不终止进程)](https://linux22.com/image/1343002/%E5%81%9C%E6%AD%A2%20ssh%20%E9%9A%A7%E9%81%93%EF%BC%88%E5%81%9C%E6%AD%A2%E7%9B%91%E5%90%AC%E7%AB%AF%E5%8F%A3%E8%80%8C%E4%B8%8D%E7%BB%88%E6%AD%A2%E8%BF%9B%E7%A8%8B%EF%BC%89.png)
在 ssh 会话中,可以通过按键~C
并输入(例如)来启动隧道-L80:localhost:80
。但是,有没有办法停止该端口上的隧道(除了终止进程)?
答案1
摘自 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.
因此,~C
接下来-KL80
取消示例中的端口转发。