vnc | | Cell 1 | Search

This code snippet configures a Linux desktop for remote access using VNC by launching a window manager and starting a VNC server on port 5900. This allows another computer to connect and control the Linux machine remotely.

Run example

npm run import -- "What is VNC"

What is VNC

fluxbox -display :0
x11vnc -forever -nopw -shared -rfbport -ncache 5900 -display :0

What the code could have been:

#!/bin/bash

# Define display number
DISPLAY_NUMBER=0

# Function to start Fluxbox
start_fluxbox() {
  fluxbox -display ":$DISPLAY_NUMBER"
}

# Function to start X11VNC
start_x11vnc() {
  x11vnc \
    -forever \
    -nopw \
    -shared \
    -rfbport 5900 \
    -ncache 1 \
    -display ":$DISPLAY_NUMBER"
}

# Start Fluxbox and X11VNC in sequence
start_fluxbox
start_x11vnc

This code snippet starts two processes to enable remote access to a Linux desktop using VNC.

  1. fluxbox -display :0:

  2. x11vnc -forever -nopw -shared -rfbport 5900 -display :0:

Purpose:

This command sequence sets up a remote desktop session using VNC, allowing you to control the Linux machine from another computer over a network.