NB 的 ssh proxycommand

是从水木上面学来的。还参考了这个

如果你工作的环境是下面这样的,那 ssh 的 proxycommand 对你会很有用。

your pc -> gw server -> work server

一般公司的服务器的网络都会设置安全级别,防止出现安全问题。那个 gw 也叫跳板机。需要在 gw 机器上面有 nc 。

修改 .ssh/config 文件,加上
Host gw
Hostname gw.abc.com

Host work
Hostname work.abc.com
User wd
ProxyCommand ssh gw nc -q 0 %h %p 2>/dev/null

这样直接 ssh work 就好了。

那个 -q 0 可能有些版本的 nc 不支持。去掉就好了。那个 %h 表示 hostname,那个 %p 表示 port,可以直接写死。其它的 man ssh_config 吧。

Related posts:

  1. smsd 发送中文短信乱码
  2. 你在用什么方式翻墙?

3 Comments

  1. Posted 十二月 9, 2009 at 12:46 下午 | Permalink

    test

  2. Posted 十二月 9, 2009 at 12:47 下午 | Permalink

    之前我也搞过这个,但是gw多了以后,还是麻烦,后来就用我那 sssh 了,哈哈。。。

  3. Posted 十二月 9, 2009 at 12:56 下午 | Permalink

    @bones7456
    还好我就一个 gw,呵呵

Post a Comment

Your email is never shared.