【问题标题】:SSH multiple HOPSSH 多跳
【发布时间】:2012-06-21 15:05:08
【问题描述】:

我有 3 个工作站

  • ortro(我的客户)
  • idrauser@idra(中间)
  • cerberouser@cerbero(目的地)

在伊德拉上:

ssh -L 9999:idra:22 cerberouser@cerbero

在 otro 上:

ssh idrauser@idra -p 9999
ssh: connect to host idra port 9999: Connection refused

我无法在 ortro 中修改 sshd_config。我需要在 idra 和 cerbero 之间建立一个隧道,然后从 ortro 使用它

非常感谢 里卡多

【问题讨论】:

    标签: ssh tunneling


    【解决方案1】:

    -L 默认绑定到 localhost。

    使用

    ssh -L '*':9999:idra:22 cerberouser@cerbero
    

    ssh -o GatewayPorts=yes -L 9999:idra:22 cerberouser@cerbero
    

    改为。


    更安全的解决方案不会代理端口,而是代理连接。尝试将此添加到 ortro 上的 ~/.ssh/config

    Host cerbero
    User cerberouser
    ProxyCommand /usr/bin/ssh idrauser@idra /bin/nc -w 3700 %h %p
    

    然后通过运行单个命令从 ortro 连接到 cerbero

    ssh cerbero
    

    【讨论】:

      猜你喜欢
      • 2021-12-05
      • 2021-10-28
      • 2011-12-14
      • 2020-10-26
      • 2019-09-23
      • 1970-01-01
      • 2016-07-26
      • 2014-01-06
      • 2018-07-23
      相关资源
      最近更新 更多