是否可以像这样使用动态端口转发设置 SSH 隧道:
ssh -D
但反过来呢?也就是说我想在我的本地机器上启动连接并在那里进行动态端口转发,并让我的朋友将他的浏览器连接到隧道的另一端。
如果我的朋友键入以上内容,上述内容非常有效,但我不想让他 ssh 访问我的机器,只是让他代理他的浏览器。
对于 openssh,请参见-R
开关:
-R [bind_address:]port:host:hostport
Specifies that the given port on the remote (server) host is to
be forwarded to the given host and port on the local side. This
works by allocating a socket to listen to port on the remote
side, and whenever a connection is made to this port, the connec‐
tion is forwarded over the secure channel, and a connection is
made to host port hostport from the local machine.
虽然可能有更好的解决方案,但您可以remotehost
通过以下方式在您朋友的计算机上的端口 24680 上创建一个 SOCKS 代理。首先,做
ssh -R 24680:localhost:12345 remotehost
然后,做
ssh -D 12345 localhost
显然,两个会话需要同时保持活动状态。