SSH ProxyCommandで多段接続

localhost から remote1を介して、remote2にアクセスしたい場合。

  1. connectコマンドをRemote1にインストールする。
     wget http://www.meadowy.org/~gotoh/ssh/connect.c
     gcc connect.c -o connect
     cp connect $HOME/bin/
  2. Localhostの$HOME/.ssh/configを以下のようにする。
     Host remote2
     user taro
     ProxyCommand ssh remote1 /home/taro/bin/connect %h %p
  3. ssh remote2で接続できるようになる。

参考


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS