VNC on Rocky Linux with X11VNC
Jump to navigation Jump to search


Why is it so difficult to configure VNC or any "Remote Desktop" like GUI interface in Linux?

Err, wait, the question is actually: How can VNC Server be installed on Rocky Linux using X11VNC?


Install X11VNC Server on Rocky Linux 9. Forget about Tiger VNC. Nothing wrong with it at all, but this is just for basic X11VNC


First, remove all other instances of VNC Server (tigervnc*, etc.)

  • yum or dnf install x11vnc (VNC Server is installed as part of this package)
  • systemctl daemon-reload
  • type this command to start the VNC Server: x11vnc

All done? Nope. The real challenge is to get it to start as a Service. An even bigger challenge is to get it to start pre-login.

Run as a Service

Alas, not finished yet. Running the x11vnc command isn't the same as having the VNC Server running after a reboot.

Below is a very, very simple startup script. No password (can be added later);

Description=Start x11vnc at startup.

ExecStart=/usr/bin/x11vnc -display :0 -auth guess -forever -loop -rfbport 5900 -o /var/log/x11vnc.log

ExecStop =/usr/bin/x11vnc -remote stop


Good to go? Nope. That doesn't allow it to run until a user is logged in. Attempted to use the -create Switch, but it didn't work properly.

Workaround and Solution for Pre-Login VNC Server Access

...just couldn't do it.

So the work around is to have the system automatically login, thus starting the VNC service.

To facilitate automatically logging in, it depends on the version of Linux, which Desktop, and apparently barometric pressure on that particular day. Yes, it's that difficult and obnoxious (unlike Windows). Anyway, in this instance, it's going to be configured for Rocky Linux 8.8 using GNOME (the lightweight XFCE Desktop should be similar).

One or two of the following are necessary to configure (didn't test them individually, but together it works);

In /etc/gdm/custom.conf, add the following;


In /etc/systemd/system/, change whatever is on the ExecStart line to the following;

ExecStart=-/sbin/agetty --noclear --autologin root %I $TERM

That automatically logs the root user in and starts the "display :0" session of the Desktop Manager to allow X11VNC Server to accept connections

Other Notes

To determine Desktop GUI being used: echo $XDG_CURRENT_DESKTOP

To determine Linux version and Install: lsb_release -a (may need to install it first: yum or dnf install lsb_release)

Lock Screen (turn that obnoxiously agressive lock time of .5 seconds off), via the GUI: Activities, "9 Dot" Applications Menu, Settings, Privacy, Lock Screen (OFF!)

There are some indications that X11VNC will have difficulty on Rocky Linux 9 or later: (might be because of GNOME Desktop, but doesn't seem to affect XFCE Desktop and includes the Wayland VS MATE stuff)

Use this command to see if the X11 Display Server ( is being used: echo $$XDG_SESSION_TYPE (if the answer is x11, then you should be good to go)