PuTTY Cannot Open Display: How to Fix It

Last updated August 22, 2026

TL;DR

Cannot open display (or Error: Can't open display) appears when you run a GUI program over a PuTTY SSH session and X11 forwarding isn't working. The SSH connection is fine; the graphical channel isn't.

Almost always one of these:

  • No X server running on Windows (you need VcXsrv or Xming, started before you connect)
  • "Enable X11 forwarding" unchecked in PuTTY
  • xauth missing on the server, or X11Forwarding no in sshd_config

Start VcXsrv, then reconnect. Forwarding is negotiated when the session opens, so changes only apply to a fresh connection.

What you're seeing

You're logged in over SSH, you launch a graphical program, and it refuses:

$ xclock
Error: Can't open display:

Variants of the same failure:

  • xclock: cannot connect to X server
  • cannot open display: localhost:10.0 (forwarding started, then broke)
  • Gtk-WARNING **: cannot open display: (any GTK app: gedit, firefox, virt-manager)
  • qt.qpa.xcb: could not connect to display (Qt apps)

The SSH login itself succeeded. This error is about the extra channel that carries graphics back to your machine, and that channel has to be set up on both ends.

What's causing this error

A GUI program on the server doesn't draw its own window. It sends drawing commands to an X server, and over SSH that X server is on your machine. The chain looks like this: app on the server reads DISPLAY, sshd feeds the traffic back through the tunnel, PuTTY hands it to an X server running on Windows. The error means a link is missing:

  1. No X server on Windows. Windows can't display X11 graphics natively. PuTTY forwards the traffic but has nowhere to deliver it. You need VcXsrv or Xming running first. This is the cause people miss, because nothing tells you the piece is missing.
  2. X11 forwarding not enabled in PuTTY. It's off by default, and it only takes effect on sessions opened after you enable it.
  3. The server can't do its part. xauth isn't installed, or sshd_config has X11Forwarding no. Forwarding then fails silently: no error at login, DISPLAY just never gets set.
  4. DISPLAY is empty or wrong in your shell, which is usually a symptom of 1 to 3 rather than a cause of its own.

How to fix it

Work through these in order; each step depends on the one before it.

Step 1: Install and start an X server on Windows

Install VcXsrv (actively maintained) or Xming, and start it before you connect. For VcXsrv, run XLaunch and accept the defaults: "Multiple windows", display number 0. It sits in the system tray doing nothing visible, which is normal.

If you searched for "xming download for putty": Xming is a separate program, not a PuTTY component or plugin. You get PuTTY from the PuTTY download page and the X server from its own project page, and both must be running.

Step 2: Enable X11 forwarding in PuTTY

In the PuTTY configuration window, before connecting:

  1. Go to Connection > SSH > X11
  2. Check Enable X11 forwarding
  3. Set X display location to localhost:0
  4. Go back to Session, select your saved session, and click Save so it sticks

Then open the connection. Enabling this mid-session does nothing; it has to be set when the session starts.

Step 3: Fix the server side

On the server, xauth must be installed:

sudo apt install xauth                # Debian/Ubuntu
sudo dnf install xorg-x11-xauth      # RHEL/Fedora

And sshd must allow forwarding:

sudo grep -i x11forwarding /etc/ssh/sshd_config

You want X11Forwarding yes. If you change it, restart sshd:

sudo systemctl restart ssh    # Debian/Ubuntu
sudo systemctl restart sshd   # RHEL/CentOS/Fedora

Step 4: Reconnect and verify

Close the session and open a new one (this matters; the forwarding handshake happens at login). Then:

echo $DISPLAY

You should see something like localhost:10.0. If it prints that, test with a small X app:

sudo apt install x11-apps
xclock

A clock window pops up on your Windows desktop and you're done. If DISPLAY is still empty, open PuTTY's Event Log (right-click the title bar > Event Log) and look for X11-related refusals; they name which end declined.

On a Mac

There's no official PuTTY here, and you don't need one. Install XQuartz, log out and back in once, then use the built-in client with forwarding enabled:

The cannot open display logic is the same: XQuartz is the X server, and it must be installed before the message goes away.

Common edge cases

SituationWhat's actually wrong
Works as your user, fails after sudosudo strips DISPLAY and the xauth cookie. Run sudo -E env DISPLAY=$DISPLAY XAUTHORITY=$HOME/.Xauthority the-app, or copy the cookie once with `xauth extract - $DISPLAY
DISPLAY looks right but connection still refusedStale X11 cookie after a hostname change. rm ~/.Xauthority on the server, then reconnect
App insists on Wayland on a modern serverX11 forwarding only carries X11. Most toolkits fall back if you force it: GDK_BACKEND=x11 the-app or QT_QPA_PLATFORM=xcb the-app
On Windows 11 with WSL availableWSLg runs Linux GUI apps with zero X server setup. ssh -X from a WSL terminal replaces the PuTTY + VcXsrv pairing entirely
putty: cannot open display when launching PuTTY itself on LinuxDifferent problem: PuTTY is a GTK app and you started it with no graphical session (a TTY, or over plain SSH). Run it inside a desktop session
Forwarding works but apps are painfully slowX11 over SSH is chatty on high-latency links. Turn on Connection > SSH > Enable compression, or use the app's own remote mode instead

Related errors