在 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
取消示例中的端口转发。