Featured image of post VNC in a Nutshell

VNC in a Nutshell

How to use VNC with command line cheatsheet

Introduction

Have you ever needed to remotely control another computer as if you were sitting in front of it? Meet VNC (Virtual Network Computing)—a cross-platform remote desktop protocol that lets you view and control graphical desktops from anywhere.


The History of VNC

VNC was developed in 1998 at AT&T’s Cambridge Labs as an open-source remote desktop solution. Unlike Microsoft’s RDP, which was Windows-specific, VNC was platform-independent, working on Linux, Windows, macOS, and even mobile devices.

Why Was VNC Created?

  • Needed a lightweight remote desktop solution for Unix systems.
  • Cross-platform support was a priority.
  • Network transparency to access remote desktops from anywhere.

Key Features of VNC

Cross-Platform → Works on Windows, macOS, Linux, and mobile devices.
Client-Server Model → Connect from any device to a VNC Server.
Lightweight Protocol → Low resource usage, ideal for embedded systems.
Open-Source Variants → TightVNC, UltraVNC, TigerVNC, and RealVNC.

Further Reading:


How VNC Works

VNC follows a client-server architecture:

  1. VNC Server → Runs on the remote machine, capturing the desktop display.
  2. VNC Client (Viewer) → Runs on the local machine, sending input events (mouse, keyboard) to the server.
  3. Remote Framebuffer Protocol (RFB) → The protocol used by VNC to transmit screen updates.

Step-by-Step Communication in VNC

  1. VNC Server starts, listening for incoming connections.
  2. VNC Client connects using an IP address and password.
  3. Screen updates are sent via the Remote Framebuffer Protocol (RFB).
  4. Client sends keyboard/mouse input back to the server.
  5. User interacts with the remote desktop in real-time.

This makes VNC a powerful tool for remote administration, technical support, and remote work.


VNC vs. Modern Remote Access Alternatives

FeatureVNCRDP (Windows)SSH X11 ForwardingTeamViewer
Cross-Platform✅ Yes❌ No (Windows)✅ Yes✅ Yes
Encryption❌ No (unless configured)✅ Yes✅ Yes✅ Yes
Performance❌ Slower✅ Faster❌ Slower✅ Optimized
Screen Sharing✅ Yes✅ Yes❌ No✅ Yes
Used ByLinux, Windows, macOSWindows UsersDevelopersBusinesses

💡 Verdict: VNC is great for cross-platform remote access, but RDP is faster, and TeamViewer is more user-friendly.


VNC Command Examples

1. Install a VNC Server on Ubuntu

1
sudo apt update && sudo apt install tightvncserver

2. Start the VNC Server on Linux

1
vncserver :1 -geometry 1920x1080 -depth 24

3. Stop the VNC Server on Linux

1
vncserver -kill :1

4. Connect to a VNC Server from a Linux Client

1
vncviewer 192.168.1.100:5901

5. Tunnel a VNC Connection Over SSH

1
ssh -L 5901:localhost:5901 user@remote-server.com

6. Set a Password for a VNC Server

1
vncpasswd

7. Configure VNC for System Startup (Linux Systemd)

1
sudo nano /etc/systemd/system/vncserver@.service

(Configure the service, then enable it:)

1
2
sudo systemctl enable vncserver@1
sudo systemctl start vncserver@1

8. Start a VNC Server on Windows (UltraVNC)

1
start "" "C:\Program Files\UltraVNC\winvnc.exe"

9. Connect to a VNC Server from Windows

1
mstsc /v:192.168.1.100:5901

10. Configure a Secure VNC Connection Using SSL

1
stunnel /etc/stunnel/stunnel.conf

Key Takeaways

  • VNC enables remote desktop access across multiple platforms.
  • It uses the Remote Framebuffer Protocol (RFB) for screen updates.
  • Unlike RDP, it lacks built-in encryption, requiring SSH tunneling for security.
  • Modern alternatives like TeamViewer and RDP offer better performance but less flexibility.

References

  1. VNC Wikipedia
  2. RealVNC Official Site
  3. TightVNC Installation Guide
  4. Secure VNC with SSH