Objectives
To define remote desktop access
To install and configure TigerVNC, a remote desktop system
To connect to the remote VNC server and perform typical desktop tasks
To configure an encrypted VNC connection to a remote server
Introduction
Sometimes there is a need for remote desktop access (RDA) that cannot be fulfilled in any other way. This type of access connects to a remote computer using tools that enable you as the user to work on a graphical desktop as easily as if you were sitting in front of the remote host with physical access to it. VNC1 stands for Virtual Network Computing and it is the tool that enables use of remote graphical desktops. TigerVNC2 is the VNC of choice for Fedora and RHCE as well as other distributions.
In Chapter 5 of this volume, we explored X-forwarding in which we used SSH to login to a remote host using the -X option and then started a single GUI application whose window appeared on our local host. The vast majority of the time, if I need remote GUI access, it is usually for a single application so that is a perfect solution.
However, using VNC can be useful if I need to perform multiple GUI-based tasks on a remote host. In a case such as this, I must set up a VMC server, such as TigerVNC,3 on the remote host and then use a client to connect with that server. The result is that a GUI desktop hosted by that remote host is displayed on my local desktop.
VNC works by transmitting keyboard and mouse events that originate on the VNC client to the remote VNC server. The VNC server performs the necessary tasks and returns any screen updates back to the client so that the VNC client window may be updated.
TigerVNC
TigerVNC is a fairly standard implementation of VNC. The VNC protocols were originally developed by the Olivetti & Oracle Research Lab in Cambridge, England.4 VNC allows multiple clients to connect to the server, and is platform-independent in that it allows compatible VNC clients for different operating systems to connect to the server. TigerVNC clients can also connect to compatible VNC servers on other operating systems.
The TigerVNC installation instructions are available in the Fedora5 specifically the Infrastructure Services section of the System Administrator’s Guide. This information can be found in the same location for RHEL 7 in the Red Hat documentation.6 I have not found VNC in the RHEL 8 documentation, possibly because the documentation structure has been changed significantly.
Experiment 14-1
Be sure to save the revised IPTables rule set.
There is very little configuration required for Tiger VNC, but one thing you must do is to create a VNC password that the remote clients will use.
Warning This password is not encrypted. Anyone with access to your home directory on the server will be able to read this file and your password.
There are a couple ways in which you can test the VNC server. You can go to another host and connect to the VNC server from there or you can connect to your own server using the client. Let’s start by testing on StudentVM2, which is why we also installed the client on it.
We can see that the server is running and the default geometry of the screen as well as the port number and the display number. Be sure to make note of the display number assigned to the session. It should be :1. Multiple displays are possible, and if you run the above command again, the next display would be :2.
This invocation of the VNC Server defaults to a remote screen size of 1024x768.

Enter the DNS name of the VNC server and the display number, and then press the Connect button

The VNC desktop
I received an error in the TigerVNC desktop window. You may see this also, but it is fine to ignore it and click Close.
Now that the window is open, you can resize it to the dimensions of your liking. You can use the remote desktop just as you would if you were sitting in front of the physical screen with a keyboard and mouse for the remote host.
Launch a couple programs like a terminal emulator and the file manager. You should explore the home directory a bit and you will see that the files and directories are those of the student user. When you have finished your explorations, close all of the programs running in the TigerVNC viewer window.
Back as the student user on StudentVM1, launch the TigerVNC viewer and log in to the VNC server on StudentVM2 as we did above.

The StudentVM1 desktop with the TigerVNC viewer containing the remote desktop for StudentVM2
Security
VNC uses unencrypted connections by default. In fact, remote desktop access in general adds a security risk to your environment, but the unencrypted connection is horrible. This could result in your data being intercepted and easily accessed. We can use the via option of the vncviewer utility to create an SSH tunnel to encrypt the connection from the client to the server.
Experiment 14-2
In this experiment, we will use SSH to encrypt our connection to the server. To begin, as the student user on StudentVM2, ensure that the vncserver is running for display :1.
This terminal session is now a tunnel to for the student user to the StudentVM2 host.
Now the VNC Authentication dialog is displayed. Note that, for me at least, it still has the red banner proclaiming the connection as insecure. Type the VNC authentication password for the student user – this is a different password than the student user’s Linux login password – and click the OK button.
At this point, the VNC session window to StudentVM2 is displayed. Experiment with this for a bit, but the remote desktop should work no differently than it did when it was not encrypted.
When finished, terminate all VNC viewer and server sessions.
Problems
I have run into one perplexing problem when using TigerVNC.
Blank TigerVNC view screen
I had installed TigerVNC on one of my smaller hosts to do some experimentation and research before starting work on this course. I had a problem accessing the VNC session after getting everything set up, including the firewall. All the VNC viewer would display was a black screen and sometimes an “X” cursor. A lot of research on Google did not provide an exact solution, primarily due to the age of some of the information and the various configuration files that appear in different distributions and at different times. That research did lead me to synthesize my own related solution to the problem.
You can see in the ~/.vnc/xstartup file that I have commented out the xinitrc line and added the startxfce4 statement at the bottom of the file. This will start the Xfce desktop. Use the start command for your favorite desktop in your own file. The VNC desktop can be different from the default login desktop.
I did not see this problem when using Xfce, or LXDE as the desktops on my hosts, but I did see it with KDE on the TigerVNC server. I did not experience this during my research for this course, but you may run into it “in the wild.”
Note
This solution only works for the specific user account for which this change has been made.
Chapter summary
This chapter has guided us through our exploration of configuring VNC remote desktop sessions. We used TigerVNC for this, but other VNC tools are available. Some of those tools are commercial.
TigerVNC is the default VNC software for many Linux distributions including Fedora. It provides us with the capability to create encrypted or unencrypted desktop connections to one or more remote servers. The server also allows multiple incoming connections so that multiple users can simultaneously use a VNC desktop on the server.
VNC is not always the correct solution for remote GUI access, but it can be the best option for some uses.
Exercises
- 1.
Is the client server terminology used in VNC consistent with its use in the standard X-Window system and X-forwarding? Why do you think that might be?
- 2.
On StudentVM2, start two VNC servers using screen :1 and screen :2. Use the TigerVNC viewer to connect to one screen from the localhost, StudentVM2. Also connect to StudentVM2 from StudentVM1 so that you have two VNC sessions running simultaneously.
- 3.
View the TCP packet stream as you open a VNC session from StudentVM1 to StudentVM2 and perform some simple tasks.