Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

NOTE: The X2Go Client is an easier alternative to VNC over SSH

This example is one method of setting up a secure VNC session tunneling over SSH. It assumes a VNC server has been installed on the remote system.

Windows

Download and unzip MobaXterm Home Edition (portable edition) 

Open MobaXterm and start local terminal


First SSH into the remote system configure the VNC session and start VNC server

  • Run the command vncpasswd to create a vnc VNC session password. It is separate than your login password, but can be set the sameGo into the directory
    • The vncpasswd command can also change/reset an existing password
    • The vncpasswd command will create a ~/.vnc directory if it does not exist
    • If needed, edit the file ~/.vnc
    and create a file named xstartup with the content:
    • /xstartup

      • Expand
        titlexstartup example

        #!/bin/sh

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

vncconfig -iconic &

dbus-launch --exit-with-session gnome-session &

      • unset SESSION_MANAGER
        unset DBUS_SESSION_BUS_ADDRESS
        gnome-session &


    • Start vncserver


      • Expand
        titleIf vncserver uses systemd (example using tigervnc)
        • Add user to /etc/tigervnc/vncserver.users
          • Start vncserver for user port: sudo systemctl start vncserver@:x
          • (optional) Set the vncserver to start on system (re)boot: sudo systemctl enable vncserver@:x



      • Expand
        titleIf vncserver does not use systemd
        • Check
    check
        • if any VNC ports are in use using the command ‘vncserver -list’ . Any active VNC ports will be listed like :1 or :2. By default VNC runs on port in the range 590x
    each vnc
          • Each VNC session runs on a unique port so to start on port 5902 use the command: 
            • vncserver :2 -localhost
    The vnc
            • NOTE: if VNC session is already running on port :2, try a higher port number like :7 or :8
          • The VNC server can be stopped with the command:
          • vncserver -kill :2
          • The VNC session resolution can be set using the -geometry option. Stop vncserver before starting a new session.
            • vncserver -kill :2
              • vncserver :2 -localhost -geometry 1280x1024




macOS

After the vncserver is running, now can configure the vnc session in mobaxtermon the Mac open the Teminal app in the Applications → Utilities folder

Create a SSH tunnel to remote VNC session using the command:

ssh -L 8888:127.0.0.1:5902 <username>@<servername>.ae.utexas.edu
  • 8888 is the local port number
  • 5902 is the remote VNC session port created above

Select "Connect to Server..." under the Go menu in the Finder. Enter the server name:

Expand
titlevnc://localhost:8888

Image Added

Enter your VNC session password

Expand
titleVNC session password

Image Added


Windows

Download and unzip MobaXterm Home Edition (portable edition) 

Open MobaXterm and start local terminal

After the vncserver is running, in MobaXterm select the Session icon to configure the VNC session

Expand
titlesession image

Image Modified

Select VNC and enter localhost in the remote hostname and select the port the vncserver was started on like 5902 in the set above

Select SSH gateway (jump host) under the Network settings

Expand
titlesession settings 1 image

Image Modified

In the SSH jump host enter the server name ase-tanaka-lab-1.ae.utexas.edu remote system name and your logon name

Expand
titlejump host image

Image Modified

Select the Bookmark settings and change the session name from localhost to the remote system name

Expand
titlesession settings 2 image

Image Added

When you connect (execute) the session, it will first ask for your server remote system password, the then ask for the vncpasswd your set when configuring the vnc server session

Image Removed

your vncpasswd

Expand
titlestart session image

Image Added


Expand
titleremote system password image

Image Added


Expand
titlevncserver password image

...

Image Modified