This topic is a rewrite of the solution to ANY vnc server in kde with sddm - credit to @bedna for the original solution.
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.
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.
Our goal is to connect to the physical display
:0 using VNC.
The remote system will act like a string puppet - you will be able to watch what happens on the remote system and so will anyone else knowing the password or - in case of an attached, powered-on monitor - watching the screen or display.
It will not be possible to share clipboard between systems.
The system to be controlled
On the system to be controlled install package
tigervnc and switch to root context
su -l root
Create a password for the root user
System service definition
Create a new service definition - the link uses LightDM as example
LightDM is used for the example below, but it should be possible to adapt it to other display managers by modifying the
– TigerVNC - ArchWiki
This example uses SDDM - edit the file, paste below content and save.
[Unit] Description=Remote desktop service (VNC) for :0 display SDDM Requires=display-manager.service After=syslog.target network-online.target display-manager.service [Service] Type=simple # This is for SDDM only # - as sddm uses a random name for the XAUTHORITY file ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment XAUTHORITY=$(find /var/run/sddm/ -type f)" Environment=HOME=/root ExecStart=x0vncserver -display :0 -rfbauth /root/.vnc/passwd Restart=on-failure RestartSec=500ms [Install] WantedBy=multi-user.target
Enable and start the service
systemctl enable --now x0vncserver.service
Install the package
tigervnc and connect
Be prepared for weird issues …
For one - after a period of inactivity - the vnc provided view may stop responding - only displaying background or black screen.
While watching the remote screen I was able to activate the password prompt and input the password - yet the vncviewer remainded black with only the mousepointer visible and still controlling the remote as could be seen on the attached monitor.
Connecting directly to screen
:0 may seem the way to go if you want to the display manager directly but poses other challenges.
Perhaps you are better of using the configuration outlined in these topics