Introduction

TigerVNC is a client/server application that allows users to launch and interact with graphical applications on remote machines. TigerVNC provides the levels of performance necessary to run 3D and video applications, and it attempts to maintain a common look and feel and re-use components, where possible, across the various platforms that it supports.


Install and Setup TigerVNC Viewer on Server


Step 1. Install TigerVNC Server.

First of all, ssh to the server with administrator account with sudo privileges, and install the packages using the following commands on the server.

$ sudo apt update
$ sudo apt install xfce4 xfce4-goodies
$ sudo apt install tightvncserver


Step 2. Setup TigerVNC Server

SSH to the server

$ ssh xxx@yyy.zzz

Configure VNC Server

$ mkdir ~/.vnc
$ vim ~/.vnc/xstartup

Copy the following command to your ~/.vnc/xstartup

#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &

The, add execution permission to ~/.vnc/xstartup

$ chmod +x ~/.vnc/xstartup


Step 3. Launch VNC Server

To launch VNC server, run the command below:

[Note]
The password must be between six and eight characters long. Passwords more than 8 characters will be truncated automatically.

# configure the resolution by -geometry
$ vncserver :1 -geometry 2560x1440
Output
You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
xauth:  file /home/hc29225/.Xauthority does not exist

New 'X' desktop is borg:1

Creating default startup script /home/hc29225/.vnc/xstartup
Starting applications specified in /home/hc29225/.vnc/xstartup
Log file is /home/hc29225/.vnc/borg:1.log


Useful commands

Note that if you ever want to change your password or add a view-only password, you can do so with the vncpasswd command:

$ vncpasswd

To list current vncserver processes

$ vncserver -list

To kill the vncserver process on the remote

$ vncserver -kill :1


Install and Setup TigerVNC Viewer on Local


Step 1. Install tigervnc-viewer

Please run the script to install tigervnc-viewer on your local machine. Note that you should have the sudo privilege of your machine or the machine is pre-installed with tigervnc-viewer.

$ sudo apt install tigervnc-viewer


Step 2. Setup TigerVNC Viewer on Local

After installing the TigerVNC on the client, you should be able to find it in our machine. You will see the configuration window after clicking the TigerVNC Viewer.




Step 3. Connect to VNC Server

Ssh to the server with port forwarding

$ ssh -L 59000:localhost:5901 -C -N -l account xxx.yyy.zzz

Or, you can configure your ~/.ssh/config like below then doing ssh

# in your ~/.ssh/config
Host xxx
    HostName xxx.yyy.zzz
    User account
    IdentityFile ~/.ssh/id_rsa
    LocalForward 59000 localhost:5901
# then, ssh to the server
$ ssh account@xxx

After ssh to the server in a terminal, Launch VNC Viewer and type in localhost:59000 and vnc password


You should be able to see the graphical user interface once connected



Troubleshooting

The gray screen is forwarded by TigerVNC


Solution: Add executable permission ~/.vnc/xstartup on the server to fix this issue

$ chmod +x ~/.vnc/xstartup


Reference: