[root tip] [How To] TigerVNC over SSH

Difficulty: ★★☆☆☆

This document is from my notepad and a real-world implementation of the document(s) found at Archlinux Wiki - TigerVNC.

VNC

VNC is a protocol where you use your keyboard/mouse/screen to monitor or control a remote system.

:warning: :zap:
VNC is per definition insecure
Opening a VNC service onto insecure networks like the internet, public libraries, internet cafès etc. may lead to information leaking and/or attempts to take control of your system.

This topic will only expose VNC to the localhost and use a secure connection using SSH.

For guidance with SSH - see [root tip] [How To] Set up your own SSH service.

The added benefit of using SSH is that you can easily adapt this example to target any remote server without sacrificing security.

TigerVNC Limitations

Multiple X sessions for a single user are not supported
TigerVNC - ArchWiki

This effectively means - if you are logged onto the physical display :0 then you cannot connect a vnc session. If you try to do so, using the same username, a black screen or system lockup will be the likely result.

In that regard it works like Microsoft RDP which logout the physical session when you initiate a remote connection and vice-versa.

Target system

On the system to be controlled install package tigervnc

VNC password

Create a password for your login

vncpasswd

Configuration

Replace the phrase $USERNAME with the username of the actual user you want to configure.

List the available sessions

ls /usr/share/xsessions

Create the file /home/$USERNAME/.vnc/config with content (replace $SESSION according to your installation e.g. openbox or lxqt).

session=$SESSION
geometry=1280x720
localhost
dpi=96

Allow user on specific display

Edit /etc/tigervnc/vncserver.users and append e.g. :4 - which in turn will correspond to port 5904 - replace $USERNAME with the user you just created the password for.

:4=$USERNAME

Start a vncserver at the selected display

systemctl enable vncserver@:4

Logout or restart the device

reboot

Controlling system

Install the package tigervnc

Connect to target system

SSH provides a secure channel and using key based authentication is the recommended method.

Open a ssh connection using port mapping

ssh $USERNAME@ip.x.y.z -L 9904:localhost:5904

Then launch the VNC viewer and input the following connection details and click connect

localhost:9904

Authenticate

Input the password created earlier (ignore the warning as we are using an encrypted connection) and you will see the remote system - which could just be a Raspberry Pi sitting next to you on the desk.

Connected to Pi using TigerVNC on MacBook Pro M1

More reading

11 Likes
[root tip] [How To] TigerVNC Quick Setup
RealVNC Issue at Login Screen
How to use remmina or other easy way to perform a remote desktop access?
Remote desktop Mac to Manjaro
Xrdp and polkit
TigerVNC Server setup fails
How to connect vnc ( server and viewer or tigervnc) manjaro OS for raspberry pi?
VNC Server Setup
VNC cannot currently show desktop
VNC Server + X11 forwarding
Getting VPS vnc working
TigerVNC with simultaneous local login
Setting up SSH for incoming logins
How to control one computer from another visually?
Tigervnc is starting and stopped immediately on a service restart
Resize of remote TigerVNC session doesn't work (RANDR extension not present)
[root tip] [How To] Hacking the ARM desktop installer
Creating virtual monitor for teamviewer?
Can't build nxproxy from the AUR
Unable to boot to desktop after latest update
Remote desktop, real and dummy monitor
Best way to access to manjaro gnome edition desktop from our network
Accessing a thick client from a thin client - - advice needed for a clamshell purchase
Change screen resolution without monitor connected using remote desktop
ANY vnc server in kde with sddm
Issue x11vnc again
Can't build nxproxy from the AUR
VNC server's systemd service
VNC server's systemd service
TigerVNC's default service template
Wayland messed things up, impossible to access remote desktop
non-ARM boot headless, ability to start/stop GUI and use gnome-remote-desktop
How to connect vnc ( server and viewer or tigervnc) manjaro OS for raspberry pi?
Remotely log into computer's GUI
How to Install VNC in Manjaro System
Need help setting up a VNC server
[root tip] Topic Collection List View
Neugierde zum Thema NAS Thinclient
Remote Desktop between 2 Manjaro Machines
Remote desktop?
Tiger VNC Connection Refused
Manjaro minimal on rpi4 - is there a simple graphical interface to use with it?
Raspberry Pis will not connect via SSH
Remote Access to home machine?
Login screen, black screen, login screen when using TigerVNC
TigerVNC Server setup fails
Stupidly basic: how to deal with "Unit file vncserver.service does not exist"?
X11vnc service is slow
Manjaro minimal on rpi4 - is there a simple graphical interface to use with it?
RealVNC "administrative privileges needed"
Accessing manjaro gnome from a windows machine by using remote desktop control
How to change "either VNC or SSHD" to "VNC and SSHD"
I can't configure XRDP it instanly shut itself after login
X11vnc extremely slow in headless mode
Using Remmina to RDP from Manjaro on one machine to Manjaro on another machine
How do I relinquish my laptop screen and keyboard to a Raspberry-pi?
[root tip] [How To] Install Raspberry Pi - VNC over SSH
Manjaro Settings Manager, Locale Settings goes back to original values when Applying
Access Manjaro RPI through internet
Cannot successfully SSH to Raspberry Pi 4