Post

Linux VNC Server

How to setup a VNC Server on Linux

On the PC / Desktop you want to access

  1. Install the X11 Server
    1
    
    sudo apt install -y x11vnc
    
  2. Then setup the initial password
    1
    
    x11vnc -usepw
    

    Press Ctrl+C to close the vnc server session.

On the remote PC

  1. You can add the command to start the vnc server on the remote PC in your ~/.ssh/config as below. This approach means the vnc-server is only running when you need it.
    1
    2
    3
    4
    5
    
    Host remote-pc-vnc
        User karubits
        Hostname 192.168.139.128
        LocalForward 5901 localhost:5901
        RemoteCommand x11vnc -localhost -display :1 -usepw -rfbport 5901 -ncache 10
    

    Then ssh the remote PC you want to see the desktop on

    1
    
    ssh remote-pc-vnc
    

    Then open your vnc viewer and connect to the localhost of your PC.

VNC Viewier - Localhost VNC Viewer - localhost connection

This post is licensed under CC BY 4.0 by the author.

© Karubits. Some rights reserved.

Follow your curiosity.