Skip to content

X-Forwarding on Windows

X11 forwarding allows a user to launch applications and see a graphical representation of the application running on a remote machine using functionality embedded in the X-Server protocols common across many Linux (and other) platforms.

Confirm the version of Windows

Windows Operating systems versions 1809 and later support X-Forwarding for accessing graphical content over an SSH Connections.

First, confirm the Windows installation is at least version 1809 by launching winver.exe. Press Win+R on the keyboard, type winver.exe in the 'Run' dialog box:

Screenshot

Information similar to the following will be displayed:

Screenshot

In the example above, the installed version of Windows is 21H2. The first two digits refer to the year, as long as the first two digits are higher than 18, the following guide applies.

Use Windows Update if it's necessary to update the Windows environment to a later build. Support for that process is outside of the scope of this document.

Confirm the version of OpenSSH

Additionally, confirm that the version of OpenSSH running on Windows is at least 8.1p1 via running the following command from a PowerShell prompt:

ssh -V

Note

A lot of commands are case-sensitive. The above command requires a capital letter V.

Screenshot

SSH connection will commonly be to a Linux environment, but there are also other operating systems that support X-Windows and X-Forwarding connections.

There are many different methods to allow X-Server functionality on Windows. This guide covers using the VcXsrv software application, but other methods include using Cygwin, MobaXterm, PuTTY (along with an X-Window server), and Xming are available. Alternate methods of access are left as an exercise for the reader and are outside of the scope of this document.

Installing X-Forwarding Support Using VcXsrv

Download the VcXsrv Windows X-Server from SourceForge at the following link: https://sourceforge.net/projects/vcxsrv/

Click on the green Download button:

Screenshot

Once the download has completed, launch the VcXsrv installer from the Downloads folder. One method is to launch 'File Explorer' from the Windows Start Menu by clicking on the Windows flag, typing 'file explorer' in the search box, and clicking on 'File Explorer':

Screenshot

Navigate to the Downloads folder and find the vcxsrv-64.x.x.x.x.installer file. Double-click on this file:

Screenshot

Accept the security warning from Windows to allow installation of the program:

Screenshot

Ensure all checkboxes are checked to select all options for the installation and click on 'Next >':

Screenshot

Click 'Install' on the Installation Folder screen:

Screenshot

Click 'Close' once the installation has completed:

Screenshot

Launch the VcXsrv client from the Windows Start Menu by searching for 'XLaunch':

Screenshot

Step through the VcXsrv configuration accepting all default settings:

Screenshot Screenshot Screenshot Screenshot

Windows Firewall will prompt to allow the VcXsrv program network access, ensure 'Private Netowrks' and 'Public Networks' are selected and click 'Allow access':

Screenshot

Testing X-Windows Functionality via VcXsrv

Check to see that the VcXsrv application is running by looking in the Windows Task Tray. This may require clicking an up arrow to expand hidden icons. The VcXsrv icon looks like an X:

Screenshot

Launch PowerShell or Microsoft Terminal and attempt use of X-Forwarding by connecting to SunLab using the -Y SSH command line option:

$env:DISPLAY = "localhost:0"
ssh -Y sun123@sunlab.cse.lehigh.edu

Where sun123 is the SunLab username.

Note

The SSH command line option -X is the preferred method to enable X-Forwarding. -Y should only be used on fully trusted platforms as it can open security vulnerabilities. Using -Y on Windows is outside of the scope of this document.

Additional Note

:0 in the above ssh command references the display number of the X-Server. VcXsrv should default to the first display being 0 and additional instances will count up. The active display number can be confirmed via hovering the mouse over the running VcXsrv application icon from the Windows Task Tray.

Screenshot

Run an X-Windows compatible program like 'xeyes'. VcXsrv should automatically allow the connection and show the graphical program:

Screenshot