XFCE: Remote Desktop via X11vnc Through an SSH Tunnel

For the first time in a loooong time I (had to) set up remote desktop sharing, starting from an existing SSH login through a single-port pinhole in an immutable router firewall.

The remote PC runs Xubuntu 20.4 LTS and I verified it already had x11vnc installed. If that’s not the case, make it so.

In order to share / control the desktop of a different user (hereinafter known as kay), I must SSH into that PC as kay. My SSH session uses public key authentication and kay has no need for outbound SSH, so just use my PC’s public key in kay‘s authorized_keys file. On the remote PC, where I am signed in as me:

cd ~
sudo mkdir /home/kay/.ssh        # kay does not have a public key
sudo cp .ssh/authorized_keys /home/kay/.ssh     # so just copy mine
sudo chown -R kay:kay /home/kay/.ssh     # transfer ownership
sudo chmod go-rwx /home/kay/.ssh     # set proper permissions

From my local PC, I can now SSH into the remote PC as kay and start x11vnc through the SSH tunnel:

ssh -v kay@remote.address -L 5900:localhost:5900 "x11vnc -display :0 -noxdamage -ncache 10 -ncache_cr -nopw"

Still on my PC, aim a VNC client at the local end of the tunnel:

novnc localhost:5900

Using novnc presents the remote desktop as a web page in a browser, although you may prefer something more traditional.

Somewhat to my surprise, It Just Worked™.