Setting up x11vnc on Raspbian for connecting on 0 display

X11VNC was better for me because I need to access the same session as being displayed via HDMI (console 0). Plus, it supports UVNC and TightVNC file transfer.

sudo apt-get install x11vnc
x11vnc -storepasswd

Create autostart entry:

cd .config
mkdir autostart
cd autostart
nano x11vnc.desktop

Content of x11vnc.desktop file:

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Comment=
Exec=x11vnc -forever -usepw -display :0 -ultrafilexfer
StartupNotify=false
Terminal=false
Hidden=false

Reboot.

If everything works perfect – skip next step:

sudo nano /boot/config.txt

And uncomment to force a console size.

framebuffer_width=1280
framebuffer_height=720