LoginSignup
25
27

More than 5 years have passed since last update.

ssh で踏み台サーバを経由して画面共有(VNC)する

Posted at

以下のような構成で、端末AのVNCクライアントから端末Cで稼働しているVNCサーバに接続する場合の設定。

踏み台サーバ経由で画面共有(VNC).png

端末A で以下のように .ssh/config に設定を記述する(VNCサーバのポートが 5900 という前提)

Host host_C
  User user_c
  ProxyCommand ssh host_B nc -w 10 3.3.3.3 22
  LocalForward 5901 3.3.3.3:5900

Host host_B
  Hostname 2.2.2.2
  Port 22
  User user_b
  Identityfile ~/.ssh/Aの秘密鍵

このように設定した後、 端末A から 'ssh host_C' として接続すると、端末Aの localhost:5901 が 端末Cの port 5900 にフォワーディングされるようになる。

この状態で、ターミナルから

$ open vnc://localhost:5901 

と叩くと、画面共有.app が起動し、端末CのVNCサーバに接続することができる。

参考

サルでも分かる多段ssh - 射撃しつつ前転

25
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
27