Select a user name for which the vncserver should run.
e.g. jpork
Install the software.
>dnf install tigervnc-server
Provide a vncserver service configuration file with the favored display id (here 1) in the name copied from libs.
>cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service
Configure the provided config file. Actually this means to replace the statement by the actual user name for which the vncserver should run.
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
#ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
ExecStart=/sbin/runuser -l jpork -c "/usr/bin/vncserver %i"
#PIDFile=/home/<USER>/.vnc/%H%i.pid
PIDFile=/home/jpork/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
Configure the firewall appropriately.
>firewall-cmd --permanent --zone=public --add-service vnc-server
>firewall-cmd --reload
Switch to the selected user and run the vncserver. The vncserver command will ask you for the password which should be used for the vnc connection.
>su - jpork
>vncserver
The vncserver command created the $HOME/.vnc directory with a default xstartup script. The xstartup script can be used to startup applications with the vncserver service. Please notice that the window manager needs to be started here too.
Default:
#!/bin/sh
# unset SESSION_MANAGER
# unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc
In order to use KDE change it to:
#!/bin/sh
# unset SESSION_MANAGER
# unset DBUS_SESSION_BUS_ADDRESS
startkde &
Stop the vncserver service with the appropriate display id.
>vncserver -kill :1
Actually a restart should do.
>vncserver
If this does not work just start the vncserver as service from root context.
>su
>systemctl daemon-reload
>systemctl enable vncserver@:1.service
>systemctl start vncserver@:1.service