Setup TigerVNC Server and Windows Client
The Virtual Network Computer (VNC) enables people to access the remote desktop environment. It is a graphical desktop sharing system that uses the Remote Frame Buffer protocol (RFB). This post introduces install and configure TigerVNC server in Debian 12/bookworm and Windows client.
1. Pre-requisites
- A Debian server ( with desktop environment installed.
- Debian version 12/bookworm
- XFce4 desktop environment
- A Windows computer will install VNC client
2. Install and configure TigerVNC server on Debian
TigerVNC is available in the Debian package repository.
$ sudo apt update
$ sudo apt install tigervnc-common tigervnc-standalone-server tigervnc-tools
Next set a VNC password
$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
Now we can start the VNC server by:
$ vncserver
Output:
New Xtigervnc server 'servername:1 (user)' on port 5901 for display :1.
Use xtigervncviewer -SecurityTypes VncAuth -passwd /tmp/tigervnc.7VAx04/passwd :1 to connect to the VNC server.
The VNC server status Can be checked by:
$ vncserver -list
TigerVNC server sessions:
X DISPLAY # RFB PORT # RFB UNIX PATH PROCESS ID # SERVER
1 5901 23736 Xtigervnc
TigerVNC server could be stopped by:
$ vncserver -kill :1
Killing Xtigervnc process ID 23736... success!
Note:
If there were multiple desktop environment available in the server, we can do a bit more"
$ vncserver -xstartup /usr/bin/gnome-session -geometry 1024x768 -localhost no :1
It creates a tigervnc server ‘dlp.srv.world:1 (user)’ on port 5901 for display
:1
.
3. Download VNC viewer for Windows
There are many free VNC viewer available, e.g.,
4. Connect to the VNC Desktop Securely
By default, VNC does not use secure protocols when connecting. Here we will use an SSH tunnel to connect to the Debian server.
In the Windows computer, open a Command or PowerShell terminal, and input:
> ssh -L 5901:127.0.0.1:5901 -N -f -l <username> -t <server>
# If remote SSH port were not the default 22, simply append -p option:
> ssh -L 5901:127.0.0.1:5901 -N -f -l <username> -t <server> -p <port>
Here the username
is the login username you configured the vncserver above, and the server
is the remote Debian server IP address.
Launch the VNC viewer, and connect to the server as:
localhost:5901
or
localhost:1
Then input the vnc password you have set in section 1. Now the remote desctop is ready.