I wrote a code to have a vncserver that is able to handle multiple user at once on headerless server. To do this, I forked x0vncserver to spawnvncserver and I extended VNCServerST and VNCSConnectionST. The current code is a draft, I have voluntarily kept only minimal changes, thus the code is durty. I would like to discuss about my implementation to improve it.
If you are interested to include my work to the mainstream I will be happy to help to cleanup it to fit the project requirement, but I'm also fine to maintain it in my own branch in my github repository. In both case I'm interested in advises and review :)
The spawnserver differ for x0vncserver because it start a new Xserver for each user that connect to the server and do not terminate the session on user connection loss. If the user reconnect, he recover his session.
The most important change to x0vncserver is that I wait for user authentication before starting a Xdesktop for that user, this looks fairly trivial but the current code is not designed to work with several Xdesktop. To start Xdesktop I use Xorg with dummy driver using a custom xorg configuration. The Xserver is started using su - username to drop root right for the user session, that also mean that the spawnvncserver must be run with root right. Moreover, the display name is choose from screen :10, the server keep in track user display name, the server expect :10 and above are free when he start.
In the side change, I did rewrote Xdesktop to use xcb instead of Xlib, because Xlib abort/exit on server connection loss <freetroll>Wahou nice Xlib ...</freetroll>. During the rewrite I have to strip down few features to save time and I used cairo to acquire the Xserver framebuffer and xkbcommon to track the keyboard state. This change may also be interesting alone.
You can find my changes here .
My first thought is to split VNCServerST in two part, on called VNCScreen and the other one VNCServer, in the case of x0vncserver they can be both used together and in my spawn server I will be able to have several VNCScreen and have only one VNCserver.
I still missing a proper handle of X session termination, the code does not include required xorg configuration, I do not know how to handle it with cmake. And I do not enforce vncserver authentification thus it's recommended to use it with " -PAMService system-auth -SecurityTypes TLSPLain -PlainUsers user1,user2 " command line.
Thank you by advance for your help.