This is a getting started guide with TigerVNC.
Licensing Terms. There are two licensing options available for TightVNC software:. GNU General Public License version 2 (often abbreviated as GNU GPL). This is the default licensing option. It's completely free but it does not allow integration with closed-source products. Read the complete text of the license here (opens in a new window). TigerVNC is an implementation of the Virtual Network Computing (VNC) protocol. This article focuses on the server functionality.
Created on: 2019-12-04
- The command specified in the ExecStart entry is invoked when we start the server using systemctl start; it uses runuser to run TigerVNC under the user’s account. The -l argument provides the username and -c specifies the command and its arguments that runuser will execute. The PIDFile entry specifies the directory in which the running process will keep track of its process ID.
- Step 2 – Install XFCE Desktop and TigerVNC. Linux has several desktop environments such as Gnome, Unity, KDE, LXDE, XFCE etc. For this tutorial, we will be using the XFCE desktop as our VNC desktop environment. XFCE is a lightweight deskto that is well suited for a server environment.
Warning
this is till a woring progress, it works on my system but doesn't in another. I am still squashing the bugs. sorry!!!
To install TigerVNC run the following:
If our desktop environment is GNOME this additional package needs to install:
To run TigerVNC Server:
We will see the following output:
For this we need to create a file name ~/.vnc/xstartup. Let's start by open a file with favourite our text editor. I am using vim:
Now paste the following code:
Tigervnc Port
Note
If we see dbus-launch error, we need to install dbus-x11 package. In ubuntu we can do this with sudo apt install dbus-x11 -y
Warning
If this script is not used we may see the following error:
VNC is not an encrypted protocol and can be subject to packet sniffing. So is by default when it starts it only accept connections from the localhost interface. We will need to use SSH tunnel to connect to the remote host. We will how to do that later in View from local host section.
But if you are not concern about security like you are running a VM on local network then and sure about security then you can allow accepting connections from all interfaces by runnnig:
Warning
as of Today(2019-12-09) the systemd is not working. please skip it until I fix it.
The systemd unit file will allow us to easily start, stop, and restart the VNC service as needed. Now we need to open a file with favourite our text editor. I am using vim:
PS: if we are using vim it would be a good time to enable paste mode with Esc then : the type set paste
Now paste the following lines in that file:
Note
maybe we should move the config like -geometry, -autokill and -localhost to config file
If we notice the code for the systemd file we will see:
In line 6 we have a $USER variable. We need to replace that to our user name.
In line 11 we have used the vncserver command to start the vncserver to only accept connections from localhost interface. This is recommended and used by default. To connect from remote host we must use SSH tunnel mentioned in the previous section.
In line 13 we have used the vncserver command to start the vncserver to only accept connections from all interfaces. This is NOT recommended and thus commented out. If you want to use it comment out line 11 and uncomment this (13) line. We mast run sudo systemctl daemon-reload to see the effect of our change in vncserver@.service.
Now let's proceed to using the systemd file. First save the file and then run:
Next, enable the service:
The number 1 after the @ sign defines the display port on which the VNC service will run. As we discussed in the previous section since we are using 1 the VNC server will listen on port 5901
Start the VNC service by executing:
Verify that the service is successfully started with:
Tigervnc Black Screen
The recommended approach is to create an SSH tunnel that will securely forwards traffic from our local host on port 5901 to the server on the same port. To setup port forwarding run:
Now we will install a VNC viwer in our local host:
Or you can use the Remmina if you are in Ubuntu.
Tigervnc Arch
If you used port forwarding then put 127.0.0.1:5901 in and connect.
Tigervnc Linux Mint
If you used -localhost no the put the ip address of the remote host and connect.