我在 Ask Different 中发布了一个关于 MacOS 上 VNC 和 SMB 的 SSH 隧道的问题,因为我认为它特定于 Mac,但似乎并非如此。简而言之,我可以通过 SSH 从我的机器 A 到机器 B(两台都是 Mac),无论是当 A 与 B 在同一个 LAN 上还是当 A 在 LAN 之外时。当我在同一 LAN 上时,我还可以通过 VNC 和 SMB 从 A 到 B 连接。但是,当我不在 LAN 上时尝试打开从 A 到 B 的 SSH 隧道以建立 VNC 或 SMB 隧道时,连接失败。
我已经验证我使用了正确的命令% ssh -L 1445:127.0.0.1:445 -L 15900:127.0.0.1:5900 -p 2216 -v myhost
和 URL vnc://127.0.0.1:15900
。我还启用了详细的 SSH 日志记录(这是我连接 SSH 时的情况):
debug1: Local connections to LOCALHOST:1445 forwarded to remote address 127.0.0.1:445
debug1: Local forwarding listening on ::1 port 1445.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 1445.
debug1: channel 1: new [port listener]
debug1: Local connections to LOCALHOST:15900 forwarded to remote address 127.0.0.1:5900
debug1: Local forwarding listening on ::1 port 15900.
debug1: channel 2: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 15900.
debug1: channel 3: new [port listener]
debug1: channel 4: new [client-session]
这是来自失败的 VNC 连接:
debug1: Connection to port 15900 forwarding to 127.0.0.1 port 5900 requested.
debug1: channel 5: new [direct-tcpip]
debug1: Connection to port 15900 forwarding to 127.0.0.1 port 5900 requested.
debug1: channel 6: new [direct-tcpip]
debug1: channel 5: free: direct-tcpip: listening port 15900 for 127.0.0.1 port 5900, connect from 127.0.0.1 port 51566 to 127.0.0.1 port 15900, nchannels 7
debug1: Connection to port 15900 forwarding to 127.0.0.1 port 5900 requested.
debug1: channel 5: new [direct-tcpip]
debug1: channel 6: free: direct-tcpip: listening port 15900 for 127.0.0.1 port 5900, connect from 127.0.0.1 port 51567 to 127.0.0.1 port 15900, nchannels 7
debug1: channel 5: free: direct-tcpip: listening port 15900 for 127.0.0.1 port 5900, connect from 127.0.0.1 port 51569 to 127.0.0.1 port 15900, nchannels 6
这是来自 B 的系统日志,根据连接尝试进行过滤:
2023-08-18 08:52:05.095119+0200 0xe3cc3b Default 0x0 98235 0 screensharingd: SendAuthenticationInfoMessage
2023-08-18 08:52:05.126178+0200 0xe3cc3b Default 0x0 98235 0 screensharingd: HandleViewerAuthenticationMessages 2
2023-08-18 08:52:05.126193+0200 0xe3cc3b Default 0x0 98235 0 screensharingd: SendRSAResponseSRPAuthentication
2023-08-18 08:52:05.306678+0200 0xe3cc3b Default 0x0 98235 0 screensharingd: HandleViewerAuthenticationMessages 10
2023-08-18 08:52:05.306684+0200 0xe3cc3b Default 0x0 98235 0 screensharingd: SendRSAResponseSRPAuthentication
我在这些日志中没有看到任何明显的问题,是吗?接下来我可以做什么来调试我的问题?