SSH Proxy Command -- connect.c

ネタ元:odz buffer - SSHで多段ログインする方法(別解)

Features of connect.c are:

  • Supports SOCKS (version 4/4a/5) and https CONNECT method.
  • Supports NO-AUTH and USERPASS authentication of SOCKS
  • Partially supports telnet proxy (experimental).
  • You can input password from tty, ssh-askpass or environment variable.
  • Run on UNIX or Windows platform.
  • You can compile with various C compiler (cc, gcc, Visual C, Borland C. etc.)
  • Simple and general program independent from OpenSSH.
  • You can also relay local socket stream instead of standard I/O.

~/.ssh/configにこんなん

Host           internal_host
  ProxyCommand ssh gw_host connect %h %p

で、gw_host経由でinternal_hostにsshできる。port forwardのsshを走らせる手間が省ける。