This episode covers VNC configuration in depth: preparing ~/.vnc/xstartup for GNOME, Xfce, and KDE, setting per-session geometry and depth, running multi-display and multi-session for different users, and managing sessions with vncserver -kill.

You can already create a VNC server and connect with a viewer. Now it's time to take control of that server: choosing which desktop environment appears, setting resolution, and running more than one session at once. Episode 7 is the configuration episode — this is where your VNC server changes from merely "running" to "tailored to your needs."
This episode's focus: preparing ~/.vnc/xstartup for three popular desktop environments (GNOME, Xfce, KDE), understanding geometry and depth, running multi-displays with separate users and sessions, and closing sessions cleanly with vncserver -kill.
The ~/.vnc/xstartup file determines what runs each time vncserver creates a new display. This is the customization point that gets modified most often. Examples for different desktop environments:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startplasma-x11Change the exec line to match your installed DE. For Xfce use exec startxfce4, for GNOME use exec gnome-session. Don't forget the executable permission:
chmod +x ~/.vnc/xstartupResolution (geometry) and color depth (depth) are set per display when the server is started:
vncserver :1 -geometry 1280x720 -depth 24
vncserver :2 -geometry 1920x1080 -depth 16Note: depth 24 gives full color, depth 16 saves bandwidth significantly. vncserver :2 -geometry 1920x1080 -depth 16 is a common compromise for WAN connections that still want a large resolution.
The main advantage of Xvnc over x11vnc is its ability to run many displays. Each display gets its own port: :1 on 5901, :2 on 5902, and so on:
vncserver :1 -geometry 1920x1080 -depth 24
vncserver :2 -geometry 1280x720 -depth 24
vncserver -listvncserver -list shows both active displays. Clients can choose to connect to :1 for full resolution or :2 for something lighter.
Each user has their own ~/.vnc/passwd and ~/.vnc/xstartup files. By running vncserver as different users, you get truly isolated sessions:
sudo -u arman vncserver :1
sudo -u budi vncserver :2
sudo -u sari vncserver :3This pattern is very useful for shared servers: each person logs into their own display, with their own password and desktop environment, without interfering with each other.
To stop a display cleanly — terminating all processes and freeing the port:
vncserver -kill :1The vncserver -kill :1 command stops session :1 and all its child processes. Don't kill processes with a random kill; vncserver -kill ensures the session closes cleanly so no zombie processes hold port 5901.
For always-consistent configuration, you can create a TigerVNC config file at ~/.vnc/config:
session=xfce
geometry=1920x1080
depth=24
localhost=noWith the ~/.vnc/config file, options like session and geometry are read automatically by vncserver — so the command is simply vncserver :1 without repeating arguments.
If a session will only be accessed through an SSH tunnel (episode 14), restrict it to localhost:
vncserver :1 -localhost -geometry 1920x1080The -localhost option makes the session listen only on 127.0.0.1. Viewers on the network can't connect directly; you must open a tunnel first — the safest pattern for VNC in public environments.
Info
Write configuration in ~/.vnc/config for displays used regularly, and keep the -localhost option for all displays accessed via SSH tunnel. Written configuration is easier to audit than a series of command-line arguments.
After changing xstartup or configuration, restart the session and verify:
vncserver -kill :1
vncserver :1 -geometry 1920x1080 -depth 24
vncserver -list
ss -tulpn | grep 590vncserver -list confirms display :1 is active again, and ss -tulpn | grep 590 confirms port 5901 is listening with the correct bind option (localhost or all interfaces).
Episode 7 brought VNC configuration to a level usable every day: preparing ~/.vnc/xstartup for GNOME, Xfce, and KDE, setting geometry and depth per display, running multi-display and multi-session for different users, and closing sessions with vncserver -kill.
Key takeaways:
~/.vnc/xstartup determines which desktop environment appears in the session.vncserver runs.:1, :2, :3 open ports 5901, 5902, 5903 — isolated multi-sessions.vncserver -kill :N closes a session cleanly with no zombie processes.In the next episode, episode 8, we jump across platforms: TigerVNC for Windows Server — installing the TigerVNC server and viewer on Windows, running winvnc as a service, and practicing cross-platform connections between Windows and Linux complete with clipboard sharing. See you there!