Windows 10 version 1809 or later has a built-in SSH client. It's a portable version of OpenSSH client built for Windows and has options for X11 forwarding. However, that X11 forwarding options didn't work in earlier versions.

Fortunately, if you're using version 8.1p1 or later of the built-in SSH client, you can finally use it for X11 forwarding. The following steps show how you can use the X11 forwarding with the built-in SSH client in Windows and X410.

Run X410

X410 is always listening on 127.0.0.1 (also known as localhost). Since that address can also be used for X11 forwarding in the built-in SSH client, you don't need to configure anything in X410; you just need to make sure X410 is running.

Check your built-in SSH client version

C:\> ssh -V
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2





If you have an older version, you can try installing the latest version as described below:

https://github.com/PowerShell/Win32-OpenSSH/wiki#installation

Set DISPLAY environment variable for Windows

If you're using X410 in its default display number setting which is set to 0, you can use the following examples as is. However, if you changed the display number via X410 command-line switches, you need to adjust the appending display number; 127.0.0.1:<display_number>.0. For example, if the display number is changed to 1, you should set the DISPLAY environment variable to 127.0.0.1:1.0 (you can also omit the last .0 and just use 127.0.0.1:1).

Windows Command Prompt

PowerShell

set DISPLAY=127.0.0.1:0.0


	
$env:DISPLAY="127.0.0.1:0.0"


	
If you want to check the DISPLAY environment variable, you can use echo command.
C:\> echo %DISPLAY%
127.0.0.1:0.0

	
	
PS C:\> echo $env:DISPLAY
127.0.0.1:0.0

	
	

If you want to permanently add the DISPLAY environment variable to Windows, you can setx command:

setx DISPLAY "127.0.0.1:0.0"




Please note that executing setx command prepares the environment variable for the future PowerShell or Windows Command Prompt sessions. Hence, if you've executed setx command in a Windows Terminal tab, you need to start a new instance of Windows Terminal in order to access the DISPLAY environment variable (just opening another tab in Windows Terminal will *not* work).

Start the built-in SSH client with -Y option

There is also a -X option for X11 forwarding. But that option cannot be used with X410.

ssh -Y <your_user_id>@<server_address>





Once you're connected to your server, you can check if X11 forwarding is ready for your Linux GUI apps by checking the DISPLAY environment variable with echo command; executing echo $DISPLAY should show localhost:10.0 or similar instead of a blank line.

Please note that the DISPLAY environment variable on your server is automatically set by the SSH server. It doesn't need to be the same as the DISPLAY environment variable that you set in Windows, and you must *not* try to manually override it.

Share This Story, Choose Your Platform!