首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ssh -D <port> <username@server.com>;但反之亦然?

ssh -D <port> <username@server.com>;但反之亦然?
EN

Stack Overflow用户
提问于 2009-05-08 22:04:34
回答 1查看 18.5K关注 0票数 24

是否可以设置具有动态端口转发的SSH隧道,如下所示:

ssh -D

但是反过来做呢?这就是说,我想在我的本地机器上发起连接,并在那里进行动态端口转发,然后让我的朋友将他的浏览器连接到隧道的另一端。

如果我的朋友输入了上面的内容,上面的代码就能完美地工作,但我不想让他通过ssh访问我的机器,只要让他代理他的浏览器即可。

EN

回答 1

Stack Overflow用户

发布于 2009-05-08 22:13:48

对于openssh,请参见-R开关:

代码语言:javascript
复制
 -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代理。首先,做

代码语言:javascript
复制
ssh -R 24680:localhost:12345 remotehost

然后,做

代码语言:javascript
复制
ssh -D 12345 localhost

显然,这两个会话需要同时保持活动状态。

票数 36
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/842021

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档