通过SSH代理连接SSH

By admin, 21 十一月, 2019

由于不明原因,某些服务器SSH不能直接访问,需要通过另外一台服务器进行间接访问。

首先建立一个SSH代理通道

ssh root@121.40.149.96 -v -D 0.0.0.0:3389

然后编辑~/.ssh/config

proxyCommand /usr/bin/nc -X 5 -x 127.0.0.1:3389 %h %p

之后的SSH命令就会通过中转服务器运行。需要注意的是,如果通过连接断了,要注释掉proxyCommand那句才能重建通道或进行其它SSH连接。 

评论

Restricted HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img src>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。
验证码
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
请输入"Drupal10"