How to configure TigerVNC Server in Linux – A Remote Desktop Application For Linux

In this article, we are going to discuss How to configure TigerVNC Server in RHEL/CentOS/Fedora. VNC stands for Virtual Network Computing is an open-source application used to share the desktop remotely in GUI (Graphical User Interface) format. It uses the RFB (Remote Frame Buffer) protocol to transfer data over the network. TigerVNC Server is an independent application that comes for all kinds of operating systems i.e Windows, Linux, macOS. VNC was first invented on the year 1998 at AT&T lab in Cambridge. Usually, the port number of the TigerVNC Server is 5901, 5902 but we can customize the port number. In TigerVNC Server also need a Server to install the Server application and a client from where we can take remote of the VNC Server. From the client-side, we have a tool called a VNC Viewer. Here also we have one disadvantage in TigerVNC Server is it used RFB protocol to transfer data over the network which is completely not secure but better than telnet. Like telnet TigerVNC Server not transfers data plain in text format. But we can implement an extra security layer for VNC Server.

So Let’s have a look at the configuration steps of TigerVNC Server in RHEL/CentOS/Fedora Linux.

How to configure TigerVNC Server in Linux – A Remote Desktop Application For Linux
How to configure TigerVNC Server in Linux – A Remote Desktop Application For Linux

Follow the below steps to configure TigerVNC Server (Remote Desktop Application for Linux)

Server Side :

IP Address – 192.168.0.105

First configure the Ethernet Card, Here in my practice Lab its eth0, and IP address is 192.168.0.105 as shown on the output below.

[root@localhost ~]# ifconfig eth0   # Check the IP Address
eth0      Link encap:Ethernet  HWaddr 00:0C:29:A4:B6:76
          inet addr:192.168.0.105  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fea4:b676/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:29501 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19961 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:36244704 (34.5 MiB)  TX bytes:2702906 (2.5 MiB)

Step : 1 Install Required Packages

Before we start the configuration of the TigerVNC Server we have to install the required packages and dependencies. So let’s go ahead and install Desktop Environment and X Windows System packages.

[root@localhost ~]# yum -y groupinstall "Desktop" "GNOME Desktop Environment" "X Window System"

Now install TigerVNC Server package using the yum repository as shown below.

[root@localhost ~]# yum install tigervnc-server xorg-x11-fonts-Type1   # Install TigerVNC Server
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.mirror.net.in
 * extras: mirrors.aluhost.com
 * updates: centos.mirror.net.in
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.1.0-18.el6 will be installed
--> Processing Dependency: xorg-x11-fonts-misc for package: tigervnc-server-1.1.0-18.el6.x86_64
---> Package xorg-x11-fonts-Type1.noarch 0:7.2-11.el6 will be installed
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.2-11.el6.noarch
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.2-11.el6.noarch
--> Running transaction check
---> Package ttmkfdir.x86_64 0:3.0.9-32.1.el6 will be installed
---> Package xorg-x11-fonts-misc.noarch 0:7.2-11.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                    Arch         Version               Repository  Size
================================================================================
Installing:
 tigervnc-server            x86_64       1.1.0-18.el6          base       1.0 M
 xorg-x11-fonts-Type1       noarch       7.2-11.el6            base       520 k
Installing for dependencies:
 ttmkfdir                   x86_64       3.0.9-32.1.el6        base        43 k
 xorg-x11-fonts-misc        noarch       7.2-11.el6            base       5.8 M

Transaction Summary
================================================================================
Install       4 Package(s)

Total download size: 7.4 M
Installed size: 10 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): tigervnc-server-1.1.0-18.el6.x86_64.rpm           | 1.0 MB     00:01     
(2/4): ttmkfdir-3.0.9-32.1.el6.x86_64.rpm                |  43 kB     00:00     
(3/4): xorg-x11-fonts-Type1-7.2-11.el6.noarch.rpm        | 520 kB     00:00     
(4/4): xorg-x11-fonts-misc-7.2-11.el6.noarch.rpm         | 5.8 MB     00:10     
--------------------------------------------------------------------------------
Total                                           410 kB/s | 7.4 MB     00:18     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : xorg-x11-fonts-misc-7.2-11.el6.noarch                        1/4 
  Installing : ttmkfdir-3.0.9-32.1.el6.x86_64                               2/4 
  Installing : xorg-x11-fonts-Type1-7.2-11.el6.noarch                       3/4 
  Installing : tigervnc-server-1.1.0-18.el6.x86_64                          4/4 
  Verifying  : ttmkfdir-3.0.9-32.1.el6.x86_64                               1/4 
  Verifying  : tigervnc-server-1.1.0-18.el6.x86_64                          2/4 
  Verifying  : xorg-x11-fonts-misc-7.2-11.el6.noarch                        3/4 
  Verifying  : xorg-x11-fonts-Type1-7.2-11.el6.noarch                       4/4 

Installed:
  tigervnc-server.x86_64 0:1.1.0-18.el6                                         
  xorg-x11-fonts-Type1.noarch 0:7.2-11.el6                                      

Dependency Installed:
  ttmkfdir.x86_64 0:3.0.9-32.1.el6    xorg-x11-fonts-misc.noarch 0:7.2-11.el6   

Complete!

Step: 2 Create Users for TigerVNC Server

As we can see above the TigerVNC Server package installed successfully, now we have to create users for VNC Server. So create users using useradd command as shown below.

Now I am going to create two users i.e. “itsmarttricks” and “helpdesk“, Follow the steps below.

Note: Here is an example I have created Two users but you can create as many users you want as per your Scenario and Requirement.

So creating the 1st User i.e. “itsmarttricks”

[root@localhost ~]# useradd itsmarttricks # Create a User "itsmarttricks"
[root@localhost ~]# passwd itsmarttricks
Changing password for user itsmarttricks.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

Creating the 2nd User i.e. “helpdesk”

[root@localhost ~]# useradd helpdesk   # Create a User "helpdesk"
[root@localhost ~]# passwd helpdesk
Changing password for user helpdesk.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

Also Read – How To Install Anydesk Remote Desktop Application In Ubuntu

Step : 3 Generate VNC Password Users

Once users created we need to Switch to both users using su command and have to generate a password for VNC Server. This password will be used to authentication with TigerVNC Server while taking remote.

Generate Password for 1st User i.e. “itsmarttricks”

[root@localhost ~]# su - itsmarttricks # Switch to User "itsmarttricks"
[itsmarttricks@localhost ~]$ vncpasswd   # Set Password to login VNC Server
Password:
Verify:
[itsmarttricks@localhost ~]$ exit
logout

Generate Password for 2nd User i.e. “helpdesk”

[root@localhost ~]# su - helpdesk
[helpdesk@localhost ~]$ vncpasswd 
Password:
Verify:

Users’ passwords are stores in a file called passwd which is located at .vnc/passwd.

Note: .vnc is a hidden directory that can be seen by using ls -a command and located at the home directory of User. Refer to the output below.

[helpdesk@localhost ~]$ ls -a   # Show Hidden Files & Directories
.  ..  .bash_logout  .bash_profile  .bashrc  .gnome2  .mozilla  .vnc
[helpdesk@localhost ~]$ cd .vnc/
[helpdesk@localhost .vnc]$ ls
passwd

Step: 4 Configure the Resolution for Users in VNC Server

Now we have to configure the main configuration file of TigerVNC Server i.e. /etc/sysconfig/vncsevers where we have to define users which we created on Step : 3 and also have to set the resolutions. So Follow the below steps to do the same. Configuration parts are highlighted in Red color.

Here we have set Resolution for both users is 800×600 means while we take remote of TigerVNC Server the screen will come in front of us with 800×600 resolution.

[root@localhost ~]# nano /etc/sysconfig/vncservers   # Configuring VNC Server

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see this URL:
# https://access.redhat.com/knowledge/solutions/7027

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERS="1:itsmarttricks 2:helpdesk"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 800x600"

Here I configured user “itsmarttricks” with port no.1 and “helpdesk” with port no. 2. You can use different ports as per your requirement.

All required configuration is done, Now we have started the TigerVNC Server service.

[root@localhost ~]# /etc/init.d/vncserver start   # Start VNC Server Service
Starting VNC server: 1:itsmarttricks xauth:  timeout in locking authority file /var/run/gdm/auth-for-root-ZdH4Pp/database

New 'localhost.localdomain:1 (itsmarttricks)' desktop is localhost.localdomain:1

Creating default startup script /home/itsmarttricks/.vnc/xstartup
Starting applications specified in /home/itsmarttricks/.vnc/xstartup
Log file is /home/itsmarttricks/.vnc/localhost.localdomain:1.log

2:helpdesk xauth:  timeout in locking authority file /var/run/gdm/auth-for-root-ZdH4Pp/database

New 'localhost.localdomain:2 (helpdesk)' desktop is localhost.localdomain:2

Creating default startup script /home/helpdesk/.vnc/xstartup
Starting applications specified in /home/helpdesk/.vnc/xstartup
Log file is /home/helpdesk/.vnc/localhost.localdomain:2.log

                                                           [  OK  ]

After start the VNC Server service it creates a script file (xstartup) and log file which is located at the .vnc directory as shown on the output above.

Start the TigerVNC Server service at startup.

[root@localhost ~]# chkconfig --level 35 vncserver on   # Start VNC Server at Startup
[root@localhost ~]# chkconfig --list vncserver
vncserver       0:off   1:off   2:off   3:on    4:off   5:on    6:off

Stop the Linux Firewall so that we can take remote VNC Server from the client-side.

[root@localhost ~]# /etc/init.d/iptables stop   # Stop IPTables Service
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]

So we have done all required configurations from the client-side, So let’s go ahead and test from the client-side to confirm if TigerVNC Server is working properly or not.

To take remote of VNC Server just download the VNC client application i.e. VNC Viewer which is freely available.  SO download it and install it on your client system.

Now open the VNC Viewer application and enter the IP Address of the TigerVNC Server.

How to configure TigerVNC Server in Linux – A Remote Desktop Application For Linux
Enter the IP Address of TigerVNC Server

Click on the continue button.

How to configure TigerVNC Server in Linux – A Remote Desktop Application For Linux
Click on Continue Button

Now here TigerVNC server asking for a Password, So enter the password of the user “itsmarttricks” which we have created on Step : 3. Here we are using the password of user “itsmarttricks” as we are taking the remote of TigerVNC Server using port :1 with IP Address (192.168.0.105:1) which we have configured in /etc/sysconfig/vncservers configuration file on Step: 4.

How to configure TigerVNC Server in Linux – A Remote Desktop Application For Linux
Enter the Password of TigerVNC Server

And we successfully able to take the remote of the Linux Operating System using TigerVNC Server Refer to the snapshots below.

Here enter the password of the user “itsmarttricks” to log in to the Linux operating system.

Note: This is the normal password to login Linux Operating System which we set after the user creating on Step: 2 not that one which we have generated for VNC Server, So don’t get confused.

That’s all, In this article, we have explained How to configure TigerVNC Server in Linux – A Remote Desktop Application For Linux. I hope you enjoy this article. If you like this article, then just share it. If you have any questions about this article, please comment.

Share this:
WhatsApp Channel Join Now
Telegram Channel Join Now
Instagram Channel Join Now

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.