My server setup is: Debian jessie with lightdm DM with only modified changes section to sudo cat /etc/lightdm/lightdm.conf:
[VNCServer]
enabled=true
command=Xvnc -rfbauth /home/abarik/.vnc/passwd
port=5900
listen-address=localhost
greeter-session=lightdm-gtk-greeter
user-session=gnome
width=1024
height=768
depth=24
I also have a desktop with primary monitor attached to it with default DM to lightdm.
My client setup: vnc client is vncviewer on mac (OS X)
How do I make sure that, if I VNC into the server from client, I reuse the primary physical display? If thats not possible, how do i keep atleast one of my virtual port
5900
active even after disconnecting?
Answer
I think X11vnc is what you want.
X11vnc provides ability to connect your physical monitor.
For lightdm, you can use the following line.
x11vnc -display :0 -auth /var/run/lightdm/root/\:0
If you want to run it constantly, you can add –loop flag like.
x11vnc -display :0 -auth /var/run/lightdm/root/\:0 --loop
Attribution
Source : Link , Question Author : amulllb , Answer Author : Siger