Windowsから多段SSH
踏み台をいくつか超えてサーバに接続した時のメモ。
クライアント
ck3の使い方はzipファイル中のドキュメントで。
とりあえず色とフォントだけ変えれば普通にviやtopやlessが使えるみたい。
設定ファイル
- 2段の踏み台の後に目的のサーバにsshするための ~/.ssh/config の例
- 起動例: ssh target-1-name
- 起動例: rsync -e ssh *.pl target-1-name:/path/to/copy/
Host fumidai-1-name User user-name IdentityFile ~/.ssh/key-file TCPKeepAlive yes Host fumidai-2-name User user-name IdentityFile ~/.ssh/key-file ProxyCommand ssh fumidai-1-name nc -w 3600 (fumidai-2のプライベートIPアドレス) 22 TCPKeepAlive yes Host target-1-name User user-name IdentityFile ~/.ssh/key-file ProxyCommand ssh fumidai-2-name nc -w 3600 (target-1のプライベートIPアドレス) 22 TCPKeepAlive yes
- tail -f などする場合、 nc コマンドの -w オプションは長めに設定すること。最後にreadしてから指定病数が経過すると切れる。
- ホストの名前部分は実在するホストでなくてもよい, nc コマンドのアドレスのところに好きなIPアドレスを書ける