When I was using a Mac as my media center player I liked that you could “remote desktop” into it; basically VNC and got the existing desktop. This meant I could use my local keyboard and monitor to control the machine that was 20ft away across the room from me, in the odd case where the command line wasn’t sufficient.
As MacOS went on these occurrences got more frequent… as did the BROKENNESS of the VNC server; I would frequently just get a black screen. sigh
But I’ve migrated away from MacOS to a Debian Linux desktop.
I’m now using mpd
as my music player (and have written
go-mpd-music
to give me a command line similar to what I was used to, and
go-mpd-flirc to let me use
an IR remote.
The problem was the remote desktop.
This turns out to be a hard thing for me to google, so I’m writing this up in the hopes it might help someone else.
vncserver
On Unix if you run vncserver
then it will create a new desktop that
you can VNC into. This is normally a good thing ‘cos it lets multiple
people all connect to the same machine, have their own desktops that
don’t conflict. You don’t even need a desktop X session running.
But that’s not what I want.
x2vnc
Totally not what we want; this lets you move your mouse and keyboard off the edge of the screen and it will translate the motion/presses into VNC events sent to a remote VNC server. In this way you can share your your keyboard/mouse between a Linux machine and another (eg Windows, running a VNC server).
x0vncserver
This is part of the TigerVNC package which may do what I want, but the description “an inefficient VNC server which continuously polls any X” didn’t make me want to look further.
tigervnc Xorg extension
Ah, now this is what I want. It’s meant to be more efficient than the normal “scraper” method and it’s an Xorg module so is loaded automatically when the X server starts.
Except it’s very poorly documented and it took me a while to find out how to deal with it.
In the end, on Debian, it turned out to be quite simple:
1. Install
The package is part of the Debian 12 repo, so we can simply install it.
sudo apt install tigervnc-xorg-extension
2. Configure.
Create /etc/X11/xorg.conf.d/10-vnc.conf
with the following contents:
Section "Module"
Load "vnc"
EndSection
Section "Screen"
Identifier "Screen0"
Option "UserPasswdVerifier" "VncAuth"
Option "PasswordFile" "/etc/tigervnc/passwd"
EndSection
3. Create a password.
sudo vncpasswd /etc/tigervnc/passwd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
4. Restart the X server
Probably easiest to reboot :-)
5. Check
After the reboot you can verify that the server is listening:
sudo netstat -anp | grep 5900
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 1016/Xorg
tcp6 0 0 :::5900 :::* LISTEN 1016/Xorg
Yup, port 5900 is the default VNC port!
And that’s it. You can now vncviewer yourmachine:
and the native desktop
will display.
Summary
This might have been easier if I knew the magic words to search for, but search results were full of entries around how to start a new X session under VNC, how to manage the window manager inside that session and the like.
It was only luck that found me a reference to this Xorg plugin!