Skip to content

Dear Internet Explorer user: Your browser is no longer supported

Please switch to a modern browser such as Microsoft Edge, Mozilla Firefox or Google Chrome to view this website's content.

Accessing remote Linux GUI apps from Windows 11

The use of an X server permits the execution of graphical user interface (GUI) apps on one machine whilst being displayed on another. Here’s a guide to setting this up from Windows 11.

If you perform work on a remote Unix computer (such as when using a High Performance Computing cluster), you’d be familiar with logging-in on the command line via SSH. But what if you need to access a graphical user interface? For instance, you might be developing pipelines for image analysis, or performing data analysis in R via RStudio. These tasks cannot be completed without a GUI, yet without having direct access to the hardware, how can this be achieved?

The answer is to use an X server (instructions below). Xserver is the display server for the X Window System, which provides the basic framework for building graphical user interfaces on Unix-like operating systems. It allows for network-transparent graphical displays, enabling applications to run on one machine while displaying on another.

The set-up for this can be tricky. One relatively easy solution is to run X2Go, a GUI app written for Windows. Whilst this will get the job done, it’s very clunky and doesn’t support some modern security features (such as logging-in with SSH keys managed by a password manager).

The better option is to set-up an X server. There are several options for this:

The most popular two are Xming and VcXsrv. I prefer to use VcXsrv because it’s open-source and free, unlike Xming and the other various offerings.

Steps for Setting-Up an X server on Windows 11

Step 1: Download and Install VcXsrv on Windows 11

Download VcXsrv from the official source and install it. You can also download and install it via Winget using the following command:

winget install --id marha.VcXsrv

Step 2: Set-Up VcXsrv

Assuming that you have not run an X server before, this should be straightforward. Launch VcXsrv from the Start menu in Windows by typing “Xlaunch”. This will initialise the programme.

Click on “multiple windows” and then choose “0” (zero) for the Display Number. Then press “Next”.

Screen capture of a window for VcXsrv in Windows 11 that shows options for choosing the display and setting the display number.
The Display Settings window for VcXsrv will ask users to choose the number or type of screens and the Display Number.

Choose “Start no client” (the default option) and click on “Next”.

Screen capture of the client startup pane in VcXsrv
The Client Startup window in VcXsrv.

Select “Disable access control” from the selection, then press “Next”.

Screen capture of the Extra Settings window in VcXsrv.
The Extra Settings window in VcXsrv.

If you would like to save your configuration for easy launching next time, choose “Save Configuration”. Save that file to a safe location. In future, if you want to launch VcXsrv without repeating these steps, you can double-click on this file.

Screen capture of the Finish Configuration window in VcXsrv.
The Finish Configuration window in VcXsrv.

When complete, press “Next”.

VcXsrv will now launch. You will be able to confirm this by looking for the Xorg logo in the toolbar.

Screen capture of the Windows task bar.
The Windows 11 task bar shows an Xorg logo when VcXsrv is launched.

Step 3: Log in to your server

I prefer to use Windows Terminal to access remote servers, but you can also use PuTTY.

On the command line, log into your server as follows:

ssh -Y username@server

Note the use of the -Y flag.

Step 4: Run a GUI-based application

From the command line, launch a GUI-based application that may be installed on your server. For instance, thunar or rstudio. A new window should open-up that displays the GUI app.

Screen capture of Thunar displayed in Windows 11, showing files on a remote server.
Thunar – a Linux file manager app – displayed in Windows 11 and showing the files located on a remote server.

Problem-Solving

If this doesn’t work, there are a few things to try.

Check the Display variable

Enter the following command:

echo $DISPLAY

The result should be something like localhost:10.0 or 127.0.0.1:10.0. If it is something else, then the X11 forwarding isn’t actually being used.

If another IP address is listed, enter the following command:

nano ~/.bashrc

Then remove any lines that look like export DISPLAY=XXX.XXX.XXX.XXX:0.0.

Next, clear DISPLAY:

unset DISPLAY

Finally, reload the file:

source ~/.bashrc

You may need to restart VcXsrv and reconnect to your remote server to get this to work.

Kill Previous Sessions

If you have any previous VcXsrv sessions running for any reason, kill them in PowerShell:

taskkill /F /IM vcxsrv.exe

   

Comments

No comments have yet been submitted. Be the first!

Have Your Say

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.