How to setup VNC server as user in AlmaLinux 8 & CentOS 8

  • For setting up a VNC server as a Linux user, you must complete all the following steps as the same user. You must ssh to the server as the intended user and must not sudo or su – .
  • The following steps can be used to configure the Xvnc server in Alma Linux 8.
  • Copy /usr/lib/systemd/user/vncserver@.service to ~/.config/systemd/user/ as follows:

$ mkdir -p ~/.config/systemd/user
$ cp /usr/lib/systemd/user/vncserver@.service ~/.config/systemd/user/

  • After copying files, reload the user’s systems as follows:

$ systemctl --user daemon-reload

  • Use vncpasswd command to setup password for the root user as follows:

$ vncpasswd

  • Enable vncserver service and allow it to run at boot time as follows:

$ systemctl --user enable vncserver@:<display>.service --now

  • You must not use displays 0 and 1 and only use between 2 and 99.
  • As the final step, enable lingering as follows:

$ loginctl enable-linger

Leave a Reply