I’ll introduce how to open GUI apps via Linux->WSL->Windows X11 forwarding through Linux PC/server and WSL Linux Bash environment on Windows.
I’ll try SSH from Windows to ConoHa VPS via WSL and edit gedit launched on ConoHa in Windows.
Procedure
It’s mostly written in xorg - How to forward X over SSH to run graphics applications remotely? - Unix & Linux Stack Exchange.
xauth is normally installed, but if not, it needs to be installed. (Server side)Your client must be set up to forward X11. Your server must be set up to allow X11 forwarding. Your server must be able to set up X11 authentication.
type xauth
On the client side, write the following in ~/.ssh/config.
sublime_text ~/.ssh/config
Host *
ForwardAgent yes
ForwardX11 yes
XAuthLocation /usr/bin/xauth
ForwardX11Trusted yes
Check whether the server-side sshd_config file has X11Forwarding yes. If not, add it. It’s usually there.
cat /etc/ssh/sshd_config | fzf
Connect via SSH from the client. Add -X. The -v (verbose) option is also recommended for debugging purposes.
Example of connecting from WSL to ConoHa VPS: ssh -v -X -L 4000:localhost:4000 -R 52698:localhost:52698 [email protected]
To further pass from WSL to Windows, use X SERVER software.
Xming X Server for Windows download | SourceForge.net
Download and install the software called xming.
By default, it’s launched on port 0:0, so add the following to .bashrc.
export DISPLAY=localhost:0.0
If you changed the port to 1, 2, etc. due to multiple launches or errors*1, change the above code as well.
1: As introduced in a separate article, there are many bugs. It doesn’t seem to be updated, but there’s no choice. Recommend tail -f “xming.0.log”.
It’s good to try gedit in WSL without SSH and see if it renders on Windows. Then try gedit over SSH, and if gedit displays via WSL, it’s OK.
(I’m pushing for via WSL, but VPS -> windows(powershell) should also work.)
known errors
- No xauth data; using fake authentication data for X11 forwarding.
XAuthLocation /usr/bin/xauth is not in the client's config
[SOLVED] Problem with “Warning: No xauth data; using fake authentication data for X11 forwarding.”
- Bad owner or permissions on /home/yuis/.ssh/config
sudo chmod 600 ~/.ssh/config