Difficulty: ★★☆☆☆
VNC
VNC is a protocol where you use your keyboard/mouse/screen to monitor or control a remote system.
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.
It is highly recommended to only expose VNC to the localhost and connect using a secure connection using SSH or VPN.
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 (to be controlled)
A graphic environment.
If you start from scratch - e.g. installing a raspberry pi bottom up - you can install lxqt which is fast and has a low memory footprint also it does not take a lot of diskspace.
sudo pacman -Syu lxqt breeze-icons xterm
Install package tigervnc
sudo pacman -S tigervnc
VNC password
Create a password for your login
vncpasswd
Configuration
Session
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, plasma, lxqt).
session=$SESSION
geometry=1280x720
dpi=96
Example
printf "session=lxqt\ngeometry=1280x720\ndpi=96\n" > ~/.vnc/config
Display configuration
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
Example
echo :4=manjaro | sudo tee -a /etc/tigervnc/vncserver.users
Start the vncserver service for the selected display
systemctl enable vncserver@:4
Restart the system.
reboot
Controlling system
Install the package tigervnc
Connect
Connect using the command line
vncviewer ip.a.b.c:5904 &
Authenticate
Input the password created earlier and you will see the remote system.