$ uname -a A_BLOG_ABOUT_UNIX_TOOLS_AND_THE_BEAUTY_OF_SIMPLE_SYSTEMS
SYS.YEAR  2026
← Back to articles
2026-08-17ARTICLE

00a Vnc

Set Up the VNC Display

ApplixWare needs an X11 display. This setup runs TigerVNC's Xvnc directly inside the applix151 jail on display :1, TCP port 5901.

1. Install the server and basic X clients

Run from the FreeBSD host:

jexec applix151 pkg install -y \
  tigervnc-server xset xauth xsetroot xterm font-misc-misc fluxbox

xterm provides a simple test client. font-misc-misc and the X server's built-ins font path provide ordinary bitmap fonts and the cursor font.

2. Create the password and start Xvnc

jexec applix151 sh -c '
  install -d -m 700 /root/.vnc

  pw=$(openssl rand -base64 18)
  printf "%s\n" "$pw" | vncpasswd -f > /root/.vnc/passwd
  chmod 600 /root/.vnc/passwd

  printf "%s\n" "$pw" > /root/.vnc/vnc-password
  chmod 600 /root/.vnc/vnc-password

  daemon -p /var/run/xvnc.pid -o /root/.vnc/xvnc.log \
    /usr/local/bin/Xvnc :1 \
    -geometry 800x600 \
    -depth 16 \
    -rfbport 5901 \
    -SecurityTypes VncAuth \
    -rfbauth /root/.vnc/passwd \
    -AlwaysShared=1 \
    -AcceptSetDesktopSize=0 \
    -localhost no \
    -fp /usr/local/share/fonts/misc,built-ins
'

The important options are:

  • :1 selects X display DISPLAY=:1.
  • -rfbport 5901 selects the VNC client port.
  • -AcceptSetDesktopSize=0 prevents a viewer from resizing the desktop and moving old Applix dialogs outside the visible framebuffer.
  • -fp ...,built-ins retains the built-in cursor font.
  • -localhost no permits remote connections; expose this port only on a trusted network or through an appropriate firewall or tunnel.

Running Xvnc directly avoids relying on vncserver and a generated xstartup file. In the minimal jail, that wrapper failed when its expected X startup programs were absent.

3. Initialize the desktop

After Xvnc is ready, restore its font path, set a visible cursor, and start Fluxbox:

jexec applix151 sh -c '
  env DISPLAY=:1 xset fp= /usr/local/share/fonts/misc,built-ins
  env DISPLAY=:1 xset fp rehash
  env DISPLAY=:1 xsetroot -cursor_name left_ptr
  env DISPLAY=:1 fluxbox >/root/.vnc/fluxbox.log 2>&1 &
'

The built-ins entry is required by xsetroot -cursor_name left_ptr. Without it, X_OpenFont can fail with BadName, and the VNC pointer may be invisible.

4. Verify the server

jexec applix151 env DISPLAY=:1 xset q
jexec applix151 sockstat -4 -l | grep 5901

xset q proves that the jail can connect to X display :1. sockstat proves that the VNC server is listening on port 5901.

Optionally launch an X terminal before testing ApplixWare:

jexec applix151 sh -c 'env DISPLAY=:1 xterm >/dev/null 2>&1 &'

Display the generated VNC password:

jexec applix151 cat /root/.vnc/vnc-password

Connect a VNC viewer to the jail's IP address on port 5901; for the jail used in the investigation, that address was:

192.168.3.51:5901

5. Stop the server

jexec applix151 sh -c '
  if test -s /var/run/xvnc.pid; then
    kill "$(cat /var/run/xvnc.pid)"
    rm -f /var/run/xvnc.pid
  fi
  pkill -x fluxbox 2>/dev/null || true
'

If startup fails, inspect:

jexec applix151 tail -50 /root/.vnc/xvnc.log