![如何在出现管理禁止错误时退出 ssh 连接](https://linux22.com/image/109302/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%87%BA%E7%8E%B0%E7%AE%A1%E7%90%86%E7%A6%81%E6%AD%A2%E9%94%99%E8%AF%AF%E6%97%B6%E9%80%80%E5%87%BA%20ssh%20%E8%BF%9E%E6%8E%A5.png)
因为ssh -N -L port:host:port
我可以-o ExitOnForwardFailure=yes
在转发端口失败时提前失败。
PermitOpen
然而,当转发该特定端口被禁止时(例如,服务器上不允许该端口),这似乎不起作用。
在这种情况下我得到:
channel 2: open failed: administratively prohibited: open failed
当这种情况发生时,我怎么会失败呢?
因为ssh -N -L port:host:port
我可以-o ExitOnForwardFailure=yes
在转发端口失败时提前失败。
PermitOpen
然而,当转发该特定端口被禁止时(例如,服务器上不允许该端口),这似乎不起作用。
在这种情况下我得到:
channel 2: open failed: administratively prohibited: open failed
当这种情况发生时,我怎么会失败呢?