VNC is a protocol where you use your keyboard/mouse/screen to monitor or control a remote system.
NOTE: The setup is not implementing any VNC encryption so SSH will be used to establish the connection. See [root tip] Set up your own SSH service.
The benefit of using SSH is that you can easily adapt this to target any remote server without sacrificing security.
On the system to be controlled install package
Create a password for your login
Replace the phrase
$USERNAME with the username of the actual user you want to configure.
List the available sessions
Create the file
/home/$USERNAME/.vnc/config with content (replace $SESSION according to your installation e.g. openbox)
session=$SESSION geometry=1280x720 localhost dpi=96
/etc/tigervnc/vncserver.users and append e.g.
:2 - which in turn will correspond to port 5902 - replace $USERNAME with the user you just created the password for.
Start a vncserver at the selected display
systemctl enable vncserver@:2
Reboot the device
Install the package
SSH provides a secure channel and using key based authentication is the recommended method.
Open a ssh connection using port mapping
ssh $USERNAME@target.system -L 9902:localhost:5902
Then launch the VNC viewer and input the following connection details and click connect
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.