Sometimes, ssh shell access to a remote machine is not enough and you really need to see the user's desktop. Particularly when you are trying to help people that have little or no computer skill.
Luckily (or unluckily if you look at it in a different way) I need Linux to Linux remote access. But VNC alone can sometimes be a pain to set up correctly (and securely), and when you need to see a running X session not start a new one. There are a few "point and click" GUI solutions for Linux and one decent one appeared to be Teamviewer. It has a standard installer and a (Wine-based) GUI which is easy to use. I tried this and it worked very well - until it didn't. For some reason, it stopped working correctly and I could only see a black screen not the client desktop. I could not seem to fix this so had to look for something else.
Enter x11vnc.
X11vnc lets you connect via a VNC viewer to a real X11 session. So you can view and interact with the remote user's desktop as they watch. This is how I set up X11vnc and use an SSH tunnel to encrypt and secure the connection. Using SSH public key support only, this makes a very easy to use solution, and your user doesn't need to do anything at all.
This is the system that needs support.
/root/bin/x11vnc
This assume we are running Gnome and the Gnome Display Manager v3 (GDM3). The main point of this is to locate and use the X11 cookie that will allow a connection to the X server.
Make it executable : chmod +x /root/bin/x11vnc
Now create an x11vnc configuration file :
/root/.x11vncrc
This is the system from which you are doing support.
Type the following command (replace HOST and PORT as applicable) in a terminal on your system :
This starts the x11vnc script on the remote system (script created as above) and tunnels through SSH.
In another window, type the following to run your VNC viewer :