Running remote graphical Linux programs through Windows Subsystem for Linux

I have recently been using the Windows Subsystem for Linux on my Windows 10 laptop at work, with Ubuntu running as the distribution in the subsystem.

I recently had a need to use a graphical (X11) program running on a remote Linux VM. I was able to successfully run the program remotely, with the display on my local laptop by doing the following:

  • Install the Xming X11 server on Windows
  • Open a WSL Ubuntu shell (bash) and run export DISPLAY=localhost:0
  • run ssh -X username@remotehost.fqdn
  • on the remote host, run xprogram

I’ll say, the display of the program popped up *immediately* and was very performant throughout my use of it. I was quite impressed. (I have done this same kind of thing before with Xming + Putty + X11Forwarding, and the performance was never so bad to be unusable, but it was never all that impressive, either. This felt like I was running the program locally! Granted, the remote VM was running on hardware running in the same building in which I am working, but the performance was impressive nonetheless compared to a variety of other solutions I have used in the past, including “native” XWindows on a local Linux system with SSH X11Forwarding.)

In order to make this available to me in future sessions of my local WSL Ubuntu, I added export DISPLAY=localhost:0 to my local ~/.bashrc

This allows you to run other X programs from within the local WSL as well! For instance, I installed some basic programs in my WSL Ubuntu instance with sudo apt install x11-apps and then I could run xeyesand get the output on my monitors.

Win!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.