【问题标题】:SSH local port forward can not access from outside [closed]SSH本地端口转发无法从外部访问[关闭]
【发布时间】:2015-08-11 08:37:49
【问题描述】:

之后

server-a$ ssh -L 9000:imgur.com:80 user@example.com

我只能

server-a$ telnet 127.0.0.1 9000

从server-a,不能从外部访问server-a的9000端口。

如何从外部访问服务器-a 9000,我没有任何 iptables ?

PS:我之前也遇到过这个问题,修改了sshd_config之后,这个问题就解决了,但是我不记得我改了什么了。

【问题讨论】:

    标签: linux bash ssh portforwarding


    【解决方案1】:

    在命令中添加 -g

    ssh -g -L 9000:imgur.com:80 user@example.com
    

    来自 ssh 人:

    -g 允许远程主机连接到本地转发端口。

    意味着 ssh 将侦听其他 IP,然后是 localhost,使您能够从系统外部连接到转发的端口。

    这在默认情况下不启用,因为它可能是一个安全问题(连接到转发端口的随机人员到达假定安全的目标服务器上)

    【讨论】:

    • 想详细说明-g 标志的作用吗?
    • 呵呵,抱歉 :-) man ssh 说:-g 允许远程主机连接到本地转发端口。
    猜你喜欢
    • 2017-06-27
    • 1970-01-01
    • 2013-12-22
    • 2013-05-14
    • 1970-01-01
    • 2012-04-07
    • 2020-08-16
    • 2017-04-27
    • 2020-02-21
    相关资源
    最近更新 更多