X11 forwarding in Windows Terminal

 I recently switched to Crashplan for my backup solution as they have better support for Linux than my previous solution. The problem was that the Crashplan client is a graphical application and one of my Linux machines I wanted to run it on is headless. 

I have known about X11 for years, reading about it when I first got introduced to Linux in the 90s. I was always confused about why the X11 client and server were running on the same machine, and why it seemed that the server was the one requesting traffic. The whole thing seemed backwards. It make sense now, given the history of the platform.

I also understand client and servers much better. They are applications running on a machine somewhere, either on the same machine or sepearate it doesn't matter so long as they can talk to each other.

That is where the magic of X11 comes in. (Yes, I am several decades late to this party.)

X11 runs all the graphical interface over a network connection. This means that the GUI can be sent to any IP address accessible to the application. I can install a program on my Linux machine in one part of the house and run it from my desktop in my office. 

Part of this capability is built into Windows, but you will need an X11 server running on Windows to display the GUI. I use XMing, however there are many options out there that I have not tried. The other program we will use is the Windows Terminal and its built in SSH client.

First, install XMing. Give it the default settings except for the SSH client it wants to install, no SSH client.

Next, run XLauch. This is the program that will launch an XMing session. Tell it Multiple Windows and set the display number to 0.

Now, in the Windows Terminal, type setx DISPLAY "127.0.0.1:0.0". This will set an environment variable telling SSH to use the localhost for the display and display number 0.

Now launch an SSH connection to your Linux machine using the -Y flag. This will tell SSH to forward X11 traffic through to the address set in the DISPLAY variable.

Lastly launch the application from the terminal. In my case that would be /usr/local/bin/crashplan but your path will vary.

In a few seconds a window will open showing the application. Remember it is still running on the Linux machine so any resources the application uses will be on the Linux box. It is only the GUI that is being sent over the network to your computer.


Here is another article explaining how to do the same thing using Windows Terminal and X410 instead of XMing.

https://x410.dev/cookbook/built-in-ssh-x11-forwarding-in-powershell-or-windows-command-prompt/


Here is a video from RetroBytes explaining the history of X11. 

https://youtu.be/R-N-fgKWYGU?si=_RaYcd3cD2mmYwhv


Here is a tutorial that also helped me get Crashplan setup on my Linux machine to begin with. Make sure you have X11 forwarding setup before running the installer otherwise it won't run since there is now windowing interface to connect to.

https://lonesysadmin.net/2015/01/25/install-crashplan-linux/

Comments

Popular Posts