In this post, we are looking to connect to an existing running desktop session using a VNC server. Imagine you would like to connect to your dual monitor desktop PC in your office from your home PC. Something very similar to what TeamViewer does for you. Thanks to the x11vnc project, now this can be easily achievable.
Please note that you might need to create a tunnel if your workstation in your office does not have a static IP address (i.e. it is behind the NAT). In order to get connected to your machine you may find this article helpful.
We use Ubuntu Desktop 18.04 to run x11vnc and connect to it. If you use a different distribution of Linux, please check x11vnc page to find out how to install it.
For the first time, set the password for x1vnc using:
Once you set your password, you can run the server by:
If you are using multiple monitors, you will see both displays next to each other. To limit the part of the screen that is shown, you can use
-clip parameters and specify which monitor you would like to get: