How to Remote Access a Linux Desktop via VNC from Windows or Mac

Ganesh Velrajan Ganesh Velrajan • 10 Min Read • Updated on Nov 09, 2026
How to Remote Access a Linux Desktop via VNC from Windows or Mac

You can remote access a Linux desktop via VNC from Windows or a Mac without port forwarding. Install TigerVNC (a virtual desktop for headless servers) or x11vnc (to share the physical screen), keep it listening on 127.0.0.1, and run the SocketXP agent, which makes an outbound TLS tunnel. Then open the desktop directly in your web browser with one click in the SocketXP Portal, or connect a native viewer: TigerVNC, RealVNC or TightVNC Viewer on Windows, or the built-in Screen Sharing app on macOS. It works on Ubuntu, Debian, RHEL, Rocky, AlmaLinux and Fedora, including servers behind NAT, corporate firewalls and CGNAT.

Want Your Linux Desktop Visible from Windows, Anywhere?

No port forwarding for VNC. Just a secure tunnel straight to your desktop.

Key Takeaways
  • Headless server or cloud VM: use TigerVNC with XFCE (Ubuntu/Debian) or GNOME (RHEL/Fedora) on display :1, port 5901.
  • Share the physical screen: use x11vnc on an Xorg session, port 5900. It can’t capture Wayland.
  • No port forwarding: sudo socketxp login <token> plus a one-line tunnel config on the Linux machine.
  • Zero-install browser access: click VNC next to the machine in the SocketXP Portal.
  • Or use a native viewer through IoT slave mode: TigerVNC/RealVNC/TightVNC Viewer on Windows, Screen Sharing on macOS, Remmina on Linux.

How Remote VNC Access to Linux Works

VNC sends the Linux desktop to a remote viewer and sends your keyboard and mouse back. A VNC server listens on TCP port 5900 + display number: 5900 for the physical screen (:0), 5901 for a virtual desktop on :1.

Reaching that port from outside the network usually means port forwarding, a public IP and firewall rules. Those are often impossible for servers in an office, a customer site or behind CGNAT, and risky everywhere else, because VNC on the open internet is constantly scanned.

SocketXP reverses the direction:

  1. The VNC server listens on 127.0.0.1 only and can’t be reached from the network.
  2. The SocketXP agent on the Linux machine dials out to the SocketXP Cloud Gateway over TLS on port 443.
  3. You reach the desktop in one of two ways:
    • In a web browser: click VNC next to the machine in the SocketXP Portal.
    • With a native VNC client: the SocketXP agent on your laptop runs in IoT slave mode and opens a private local port, for example localhost:10111, which your viewer connects to.

Which VNC Server Should You Use on Linux?

SituationVNC serverShowsPort
Headless server, cloud VM or no monitorTigerVNC (virtual desktop)A separate desktop session5901 (:1)
Desktop with a monitor, Xorg sessionx11vncThe real screen5900
Ubuntu desktop on Wayland (default)TigerVNC virtual desktop, or GNOME Remote Desktop (RDP)A separate session5901 / 3389
Old tutorials’ TightVNC ServerAvoid: effectively unmaintained——

Ubuntu’s GNOME desktop runs on Wayland by default, and x11vnc can’t capture Wayland. If you must share the physical screen, choose Ubuntu on Xorg on the login screen. Otherwise, use a TigerVNC virtual desktop, or RDP via xrdp.

Step 1: Install and Configure the VNC Server

Follow one option below.

Option A: TigerVNC on Ubuntu or Debian (headless server)

Install TigerVNC and the lightweight XFCE desktop. dbus-x11 is needed for the session to start:

sudo apt update
sudo apt install -y tigervnc-standalone-server xfce4 xfce4-terminal dbus-x11

During the install you may be asked to choose a display manager (gdm3 or lightdm). Either is fine; TigerVNC doesn’t use it.

As the user who will own the desktop (not root), set the VNC password:

vncpasswd

Create the TigerVNC config file: ~/.config/tigervnc/config on TigerVNC 1.14 and later, or ~/.vnc/config on older versions (Ubuntu 22.04/24.04):

session=xfce
geometry=1920x1080
localhost
alwaysshared

The localhost line means only local connections, such as the SocketXP agent, are accepted. Map display :1 to your user and enable the service so it starts on boot:

echo ":1=$USER" | sudo tee -a /etc/tigervnc/vncserver.users
sudo systemctl enable --now tigervncserver@:1.service
ss -tlnp | grep 5901

Your tunnel target is port 5901.

Option B: TigerVNC on RHEL, Rocky, AlmaLinux or Fedora

On Red Hat-family systems, TigerVNC works with the default GNOME desktop:

sudo dnf install -y tigervnc-server
vncpasswd

Create the TigerVNC config file (path as in Option A):

session=gnome
geometry=1920x1080
localhost
alwaysshared

Map the display and enable the service. Note that the unit name is vncserver@ here:

echo ":1=$USER" | sudo tee -a /etc/tigervnc/vncserver.users
sudo systemctl enable --now vncserver@:1.service
ss -tlnp | grep 5901

Because VNC only listens on localhost, you don’t need to open any port in firewalld. Your tunnel target is port 5901.

Option C: x11vnc (share the physical screen of an Xorg desktop)

Use this when someone is working at the machine and you need to see the same screen. It requires an Xorg session (on Ubuntu, pick Ubuntu on Xorg at login).

sudo apt install -y x11vnc
sudo x11vnc -storepasswd /etc/x11vnc.pass

Create a systemd unit so it starts on boot and listens on localhost only:

sudo tee /etc/systemd/system/x11vnc.service > /dev/null <<'EOF'
[Unit]
Description=x11vnc VNC server for the physical display
After=display-manager.service
Requires=display-manager.service

[Service]
ExecStart=/usr/bin/x11vnc -display :0 -auth guess -forever -shared -localhost -rfbport 5900 -rfbauth /etc/x11vnc.pass
Restart=on-failure
RestartSec=3

[Install]
WantedBy=graphical.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now x11vnc

Your tunnel target is port 5900.

Step 2: Install the SocketXP Agent on the Linux Machine

SocketXP’s Linux server remote access solution creates secure SSL/TLS tunnels to machines behind NAT, firewalls and CGNAT, with no router or firewall changes.

Follow the download and install instructions, then log in with the auth token from the SocketXP Portal. This registers the machine and gives it a Device ID:

sudo socketxp login <your-auth-token>

Create /etc/socketxp/config.json with the VNC port: 5901 for TigerVNC, 5900 for x11vnc. Including SSH gives you a fallback if the desktop ever fails:

{
    "tunnels": [
        {
            "destination": "tcp://127.0.0.1:5901"
        },
        {
            "destination": "tcp://127.0.0.1:22"
        }
    ]
}

Install and start the agent as a systemd service so the tunnel reconnects after reboots and network drops:

sudo socketxp service install --config /etc/socketxp/config.json
sudo systemctl daemon-reload
sudo systemctl enable socketxp
sudo systemctl start socketxp

The machine now shows as online in the Devices section of the SocketXP Portal.

Step 3: Connect to the Linux Desktop

Both methods use the same outbound-only tunnel, so neither one opens a port to the public internet:

Method 1: Web browser (SocketXP Portal)Method 2: Native VNC client (IoT slave mode)
Software on your computerNone, just a browserSocketXP agent + a VNC viewer
Works fromAny OS, including locked-down corporate laptopsWindows, macOS, Linux
Best forQuick access, support, occasional useDaily use, best image quality, viewer features

Method 1: Open the Linux Desktop in Your Web Browser

  1. Log in to the SocketXP Portal and open the Devices page.
  2. Find your Linux machine (it should show as online).
  3. Click the VNC button next to it.
  4. A VNC Login dialog opens in the browser. Enter the VNC port (5901 for TigerVNC display :1, 5900 for x11vnc), leave Username empty, and enter the VNC password you set in Step 1. Click Connect.

The desktop opens in a browser tab, the same way the SocketXP web SSH terminal works. You don’t need a viewer or VPN client, and the session runs over HTTPS.

SocketXP Portal Devices page with the VNC button that opens a browser-based VNC session to a Linux desktop
SocketXP browser VNC Login dialog with VNC port, username and password fields for connecting to a remote Linux desktop

Method 2: Connect from Windows or macOS with a Native VNC Viewer

Run the SocketXP agent in IoT slave mode on your laptop. It opens a private local port that forwards to the Linux machine’s VNC server through the tunnel. See the IoT slave mode documentation.

Windows (PowerShell):

.\socketxp.exe connect tcp://localhost:10111 --iot-slave --peer-device-id "<device-id>" --peer-device-port 5901 --authtoken <your-auth-token>

macOS or Linux:

socketxp connect tcp://localhost:10111 --iot-slave --peer-device-id "<device-id>" --peer-device-port 5901 --authtoken <your-auth-token>

You should see:

Listening for TCP connections at:
Local URL -> tcp://localhost:10111
  • Use --peer-device-port 5900 for x11vnc.
  • 10111 is any free port on your laptop. Avoid 5900 on a Mac, because macOS uses it for its own Screen Sharing service.
  • Find the Device ID in the SocketXP Portal under Devices.

Windows: TigerVNC, RealVNC or TightVNC Viewer

Windows has no built-in VNC client, so install one of these free viewers:

  • TigerVNC Viewer: open source, fast, also available for macOS and Linux.
  • RealVNC Viewer: polished UI, accepts localhost:10111.
  • TightVNC Viewer: lightweight, Windows only.

In TigerVNC or TightVNC Viewer, connect to:

localhost::10111

The double colon matters: host::port means a TCP port, while host:N means display number N (port 5900+N). When prompted, enter your VNC password.

VNC viewer password prompt when connecting to a remote Linux desktop through SocketXP

macOS: built-in Screen Sharing

  1. In Finder, choose Go → Connect to Server (⌘K).
  2. Enter vnc://localhost:10111 and click Connect.
  3. Enter your VNC password.

You can also open the Screen Sharing app from Spotlight. RealVNC Viewer and TigerVNC Viewer for Mac work too.

Linux: Remmina or vncviewer

Use Remmina with the VNC protocol and server localhost:10111, or run vncviewer localhost::10111.

Remote Linux desktop accessed via VNC over the internet using SocketXP

Performance Tuning

  • Lower the resolution for slow links: geometry=1280x720 in the TigerVNC config.
  • Lower the colour depth: add depth=16 to roughly halve the pixel data.
  • Use XFCE rather than GNOME where you can, and turn off compositing and animations.
  • Leave your viewer on automatic quality (TigerVNC Auto select, RealVNC Automatic, macOS Screen Sharing adaptive quality).
  • Connecting mainly from Windows? RDP via xrdp is often snappier, and Windows includes an RDP client.

Troubleshooting

SymptomLikely causeFix
Grey or black screen (TigerVNC)Desktop session didn’t startInstall dbus-x11 (Debian/Ubuntu). Check that session= matches a file in /usr/share/xsessions/. Read the log in ~/.vnc/ or ~/.config/tigervnc/.
x11vnc shows nothing or exitsThe desktop is running WaylandLog in with Ubuntu on Xorg, or use TigerVNC.
Browser VNC session won’t openVNC not running, or wrong port in config.jsonCheck ss -tlnp and the destination port in /etc/socketxp/config.json.
Connection refused in a native viewerSlave-mode agent not running, or wrong --peer-device-portRestart the slave-mode command; use 5901 for TigerVNC, 5900 for x11vnc.
Viewer connects to the wrong portSingle colon used in TigerVNC/TightVNCUse localhost::10111.
Display :1 already in useStale session or lock fileRestart the TigerVNC service, or remove /tmp/.X1-lock.
Machine shows offline in the portalAgent stopped or outbound 443 blockedsudo systemctl status socketxp; allow outbound TCP 443.

Security Best Practices

  • Bind VNC to localhost (localhost in TigerVNC, -localhost in x11vnc) and never forward ports 5900/5901.
  • Remember the 8-character limit: classic VNC passwords only use their first 8 characters, so the tunnel’s authentication is your real perimeter.
  • Use SocketXP access control to limit which users can open VNC sessions to which machines.
  • Lock the screen or log out after a session, especially with x11vnc on a shared physical desktop.
  • Keep packages updated with sudo apt upgrade or sudo dnf upgrade.

VNC vs RDP vs SSH for Remote Linux Access

VNCRDP (xrdp)SSH
Shows the physical screenYes (x11vnc)NoNo
Browser access via SocketXPYes (VNC button)No (use a native RDP client)Yes (web terminal)
Built-in client on WindowsNoYesYes (OpenSSH)
Built-in client on macOSYes (Screen Sharing)No (Windows App, free)Yes (Terminal)
Best forCross-platform GUI access, shared screensWindows users, per-user sessionsAdministration and scripting
GuideThis articleLinux remote desktop via xrdpLinux server SSH from Windows

Conclusion

Remote VNC access to a Linux desktop no longer needs port forwarding, a public IP or a VPN. Use TigerVNC for headless servers and x11vnc to share a physical Xorg screen, keep the VNC server on localhost, and let SocketXP’s outbound TLS tunnel do the rest. You can open the desktop in a browser with one click, or use TigerVNC, RealVNC or TightVNC Viewer on Windows and Screen Sharing on macOS.

For SSH, web apps and fleet management, see SocketXP Linux Server Remote Access. For IoT devices such as Raspberry Pi and NVIDIA Jetson, see How to Remote Access IoT Devices via VNC.

Frequently Asked Questions

  1. Can I access a Linux desktop via VNC from a web browser?

    Yes. In the SocketXP Portal, click the VNC button next to your Linux machine. A VNC login dialog opens in the browser, and after you enter the VNC password the desktop streams into the browser tab. No VNC viewer, VPN client or open port is needed.

  2. What is the best VNC server for Linux in 2026?

    TigerVNC for headless servers and cloud VMs, because it creates its own virtual desktop and ships a systemd service. x11vnc when you need to share the physical screen of a desktop running an Xorg session. TightVNC Server is effectively unmaintained and should be avoided for new setups.

  3. Does VNC work with Ubuntu's default Wayland desktop?

    x11vnc cannot capture a GNOME Wayland session. Either run a separate TigerVNC virtual desktop, log in with the 'Ubuntu on Xorg' session if you need to share the physical screen with x11vnc, or use GNOME's built-in Remote Desktop, which uses RDP.

  4. How do I connect to a Linux VNC server from Windows?

    Windows has no built-in VNC client. Install TigerVNC Viewer, RealVNC Viewer or TightVNC Viewer, run the SocketXP agent in slave mode, and connect to localhost::10111 (double colon means a TCP port in TigerVNC and TightVNC). Or skip the viewer and use the SocketXP browser VNC button.

  5. How do I connect to a Linux VNC server from a Mac?

    Use the built-in Screen Sharing app. Run the SocketXP agent in slave mode, then in Finder choose Go > Connect to Server and enter vnc://localhost:10111. RealVNC Viewer and TigerVNC Viewer for Mac also work.

  6. Can I access a Linux VNC desktop without port forwarding?

    Yes. The SocketXP agent makes an outbound TLS connection to the SocketXP Cloud Gateway, and the VNC session travels back through it. No inbound port, public IP, firewall rule or VPN server is needed, so it also works behind CGNAT and corporate firewalls.

  7. Is VNC secure for remote Linux access?

    Not on its own. Classic VNC passwords only use their first 8 characters, and the session may not be encrypted. Bind the VNC server to 127.0.0.1 so it is not reachable on the network, never forward ports 5900/5901, and carry the session inside an authenticated, encrypted tunnel such as SocketXP's TLS tunnel.

  8. Should I use VNC or RDP to access a Linux desktop from Windows?

    Use VNC when you need to see the machine's actual screen or want one tool for every OS. Use RDP through xrdp if you mainly connect from Windows and want a separate, faster session per user, because Windows includes an RDP client. Both work through SocketXP without port forwarding.

SocketXP IoT Remote Access and Device Management Platform

Remotely access, manage, and update your IoT & AIoT edge fleet with SocketXP's secure and scalable platform.

Start Your Free Trial Now!

Join thousands of satisfied users who trust SocketXP for a secure, reliable, and scalable IoT Edge device management solution. Start your free trial now.