Using an existing connection with vncserver-virtuald

vnc

There are three ways to run vncserver (RealVNC):

  1. User Mode – Show the desktop of the currently logged on user
  2. Service Mode – Show the computer's console
  3. Virtual Mode for (UNIX/Linux only) – Create and show a virtual desktop

If you have an Enterprise license, vncserver has a daemon called vncserver-virtuald which manages incoming VNC connections, authenticating users as they connect. A virtual server instance is started for each succesfully authenticated user, and the user is connected through to the new instance..

When I run the daemon and point my VNC viewer at :5999 a new vncserver session is created for my user and the desktop loads.

However, when I point a second VNC viewer at :5999 a SECOND vncserver session is created! How do I use the existing connection?

Best Answer

Option 1: Connect to the specific VNC port of your vncserver

Each vncserver session will still get its own unique port (Default: 5900+VNC_Session_Number) after the daemon has created it, and the exact port, as well as the port you can use to start the Java Client for VNC, can be found by clicking on the VNC icon inside a client.

Option 2: Set _ConnectToExisting config. option in vncserver-virtuald

After speaking with VNC support team, I have found a HIDDEN configuration option for enabling persistent virtual desktops on demand:

_ConnectToExisting=1

This parameter can be added as an argument to 'vncserver-virtuald' or it can be added in the VNC configuration file (The file specific to virtuald is /etc/vnc/config.d/vncserver-virtuald)

Using the config option _ConnectToExisting, when a user makes a second connection to the daemonPort (5999) the daemon will connect that user to the same vncserver session, rather than create a new desktop for the user.

I noticed that this configuration option cannot be found anywhere online, and this is a very useful feature, so I have posted it online here for all to see.

Related Topic