Tuesday, 16 April 2013

Same Desktop on HDMI and VNC

I wanted to have my Pi connected to a big HDMI TV on the other side of the room and control the desktop from a VNC window on another computer. It took me quite a while to find out how to do this, so I'm repeating it here. The secret was to use x11vnc instead of the tightvncserver I started off with. Install it, then store a password as the user you want to have access and it will be in ~/.vnc/passwd

sudo apt-get install x11vnc

x11vnc -storepasswd

Start the GUI on the HDMI first then run the x11vnc from the command line as the same user (either on the main desktop or remotely via ssh).

x11vnc -rfbauth ~/.vnc/passwd -display :0

Then run a VNC client like Real VNC and log in remotely on port :0.

Interestingly enough, it looks like x11vnc runs right alongside tightvncserver, allowing me to have one VNC window on port :0 (x11vnc) going to the HDMI desktop and another on port :1 (tightvncserver) with a new, independent desktop.