From 7432cb3480766b1143bf17e8c35667d4cfed4343 Mon Sep 17 00:00:00 2001
From: Mathis Rosenhauer <rosenhauer@dkrz.de>
Date: Fri, 1 Mar 2019 14:05:05 +0100
Subject: [PATCH] vnc: replace via with manual ssh tunnel so Win10 works

---
 start-vnc | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/start-vnc b/start-vnc
index 6fb0b94..3a21ac3 100755
--- a/start-vnc
+++ b/start-vnc
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright 2017 Deutsches Klimarechenzentrum GmbH
+# Copyright 2019 Deutsches Klimarechenzentrum GmbH
 #
 # All rights reserved.
 #
@@ -39,10 +39,8 @@
 # Technically, it starts a VNC server on one of the GPU nodes by
 # submitting a generated job script. A local vncviewer client is used
 # to connect to the server over an encypted ssh tunnel. After the
-# client shuts down, the server job is terminated.
-#
-# Your local vncviewer client has to support the -via
-# option. TigerVNC, TightVNC, and TurboVNC  are known to work.
+# client shuts down, the server job is terminated. TigerVNC, TightVNC,
+# and TurboVNC are known to work.
 #
 # In case of problems contact Mathis Rosenhauer <rosenhauer@dkrz.de>.
 #
@@ -136,7 +134,7 @@ clean_up () {
 
     # Remove local vnc PasswordFile
     if [[ ${SVNC_PASSWORD} = "true" ]]; then
-        rm -f "${HOME}/vnc_passwd"
+        rm -f "vnc_passwd"
     fi
     exit
 }
@@ -278,13 +276,18 @@ main () {
     echo "Vncserver started on node ${vnc_host}.dkrz.de display \
 :${vnc_display}."
 
+    local vnc_port=$((5900+${vnc_display}))
+    ssh -o ForwardX11=no \
+        -L "${vnc_port}:localhost:${vnc_port}" \
+        -Nf \
+        "${SVNC_USERNAME}@${vnc_host}.dkrz.de";
+
     local vnc_options
-    vnc_options="${SVNC_VNC_OPTIONS:-} \
-                -via ${SVNC_USERNAME}@${vnc_host}.dkrz.de"
+    vnc_options="${SVNC_VNC_OPTIONS:-}"
     if [[ ${SVNC_PASSWORD} = "true" ]]; then
         echo "Fetching password from frontend."
-        ssh_frontend "cat .vnc/passwd" > ${HOME}/vnc_passwd
-        vnc_options+=" -passwd ${HOME}/vnc_passwd"
+        ssh_frontend "cat .vnc/passwd" > vnc_passwd
+        vnc_options+=" -passwd vnc_passwd"
     fi
     echo "Connecting vncviewer to ${vnc_host}.dkrz.de"
     "${SVNC_VNCVIEWER}" ${vnc_options} :${vnc_display}
-- 
GitLab