Back to blog

Run Linux GUI apps over SSH on macOS and Windows with X11 forwarding

December 1, 2026 8 min read Kubexer Team
X11 ForwardingSSHGUIXQuartzVcXsrv

Most server work happens in text, but not all of it. A vendor installer that only has a GUI, wireshark on a capture host, a profiler, an old admin console written in Tk. The classic answer is X11 forwarding: ssh -X or ssh -Y, and the application's window appears on your desktop while it runs on the server.

The classic setup is also where people get stuck. On Windows you need to install and start an X server, then remember to set DISPLAY. On macOS you need XQuartz. Then xauth is missing on the server and the error is "cannot open display". Kubexer Terminal's X11 forwarding, a Pro feature, takes care of most of that.

What you need on each side

On the server

  • X11Forwarding yes in /etc/ssh/sshd_config (then reload sshd).
  • xauth installed: apt install xauth on Debian and Ubuntu, dnf install xorg-x11-xauth on Fedora and RHEL.

No X server is needed on the server. The application only needs its usual libraries.

On your computer

  • Windows: nothing. Kubexer Terminal ships with a built-in X server (VcXsrv). It starts the first time a remote application opens a window, runs without a tray icon, uses its own display number from :42 upward, and stops when you quit the app. Windows may ask once whether to allow it through the firewall; it only needs local connections, so you can decline.
  • macOS: install XQuartz, which is not bundled. If it is missing, the app says "Install XQuartz to show GUI apps on this Mac" with a Download XQuartz link. If it is installed but not running, it offers Start XQuartz.

Settings → Terminal → X11 forwarding has a Test connection button that does a real X11 handshake with your local display, so you can confirm the local side before involving a server.

Turning it on for a host

X11 forwarding is off by default everywhere. A GUI channel from a server to your desktop is something you should switch on deliberately, never a surprise. There are two places to set it:

  • The global Default for hosts in Settings → Terminal → X11 forwarding: Off, Auto or Always.
  • Each host's Display GUI (X11 forwarding) card in the host form: Default (use the global setting), Off, Auto or Always.

The modes mean:

  • Off: never request X11.
  • Auto: request it only if a local X server is available, and otherwise connect normally without a word.
  • Always: always request it, and if that is not possible, the terminal says why (no local X server, or the server refused).

A server that refuses X11 never costs you the shell; you still get your session. The per-host mode is part of the host record, so it syncs with the vault. Your local display configuration does not, because it belongs to the machine.

Using it

Connect and run the application:

xclock &
wireshark &
xeyes

The window opens on your desktop. The tab shows an X11 badge with a live count of connected GUI clients. Hover it for status, including the most common fix: "xauth is not installed on the server, so GUI apps will be refused." X11 works through jump chains; only the final host is asked to forward.

Trusted or sandboxed

OpenSSH has two modes. ssh -Y gives remote applications a trusted connection: everything works, but a malicious application on the server could read other windows or keystrokes on your display. ssh -X gives an untrusted connection, restricted by the X SECURITY extension, so remote applications cannot snoop on other windows, log keystrokes or capture the screen. The cost is that some applications misbehave under it.

Kubexer Terminal defaults to trusted, the -Y behaviour, because that is what makes ordinary applications work. If you connect to servers you do not fully trust, turn on Sandbox remote apps (untrusted, like ssh -X) in Settings. Sandboxing needs xauth on your local machine as well.

What happens to your X cookie

X servers authenticate clients with a secret called the MIT-MAGIC-COOKIE-1. Kubexer Terminal handles it the way OpenSSH does: the server is given a random fake cookie for each session. When a remote application connects back through the SSH channel, the app checks its first packet against the fake cookie and replaces it with the real one before passing it to your local X server. The real cookie never leaves your computer, and connections that do not present the fake cookie are dropped. On Windows the built-in server also gets its own private cookie each time it starts, rather than running with access control turned off.

Troubleshooting

  • "cannot open display": X11 was not granted. Check X11Forwarding yes on the server and that the host mode is Auto or Always.
  • "Invalid MIT-MAGIC-COOKIE-1 key": install xauth on the server.
  • Nothing happens on macOS: start XQuartz, or use Test connection in Settings.
  • An application crashes only when sandboxed: it needs a trusted connection; switch that host's session back to the default.

Limits

  • X11 forwarding is for Linux and Unix GUI programs over SSH. For full desktops, use the RDP or VNC tabs instead.
  • It is a desktop feature. The mobile apps have no local X server.
  • X11 over a long link is chatty and can feel slow; that is the protocol, not the client.

Try it

X11 forwarding is part of Pro in Kubexer Terminal. Set a test host to Always, connect, and run xclock. For whole remote desktops, see Remote Desktop inside your terminal app.