Mac から Linux へ ssh tunnel を介した VNC 接続

ssh tunnel の張り方

ssh -f -C -L 10000:host:5950 host sleep 60

  • host : vnc 接続先の計算機
  • -f : バックグラウンドで動作
  • -C : 通信を圧縮。どの程度効くのか知らない。
  • -L : ポーとフォワード
  • 10000 : ローカルの接続先ポート(適当に設定)
  • 5950 : host での接続先ポート (適切に設定)
  • sleep 60 : ssh 接続後 60 秒待機。その間に ssh tunnel を使うサービス(vnc)の通信を始めればいい。

sleep は man ssh を参考にした。以下は man ssh の"TCP FORWARDING "から引用。

The -f option backgrounds ssh and the remote command ``sleep 10'' is speci-
fied to allow an amount of time (10 seconds, in the example) to start the
service which is to be tunnelled. If no connections are made within the
time specified, ssh will exit.

ssh tunnel の、楽な張り方

これを X11 のショートカットにでも登録しておくと楽。スクリーンショット参考。


mac でのSVN クライアント (snow leopard の場合)

クライアントには/System 以下にある Screen Sharing.app が使える。

/System/Library/CoreServices/Screen\ Sharing.app

ドックにでも登録しておくと便利。

接続先は localhost:10000 (10000は ssh tunnel の時に決めた値)