win-ssh-x11-fwd
Warning: this guide uses
ssh -Y (trusted X11 forwarding over SSH), which grants remote applications broad access to your local X session, may be slow on high-latency connections, has known security limitations, and relies on legacy X11 technology. For remote desktop usage, please consider alternatives such as VNC or RDP.
This guide explains how to do X11 Forwarding with OpenSSH on Windows 10 using VcXsrv.
Note: before starting, make sure that
X11Forwardingis enabled andxauthis installed on the SSH server you want to connect to.
First of all, you need to install VcXsrv. Example with the Chocolatey package manager:
| Bash | |
|---|---|
Note: the
sudobinary here is provided by gsudo on Windows.
Then start the application (it should be XLaunch in the applications menu). After a quick configuration wizard, it will minimize to the Windows tray bar.
Now you can connect to an SSH server with X11 Forwarding. Open a Git Bash window and type the following (adjusting the server connection parameters):
| Bash | |
|---|---|
Note: by specifying
DISPLAY=127.0.0.1:0the X client will connect to TCP port 6000, where the VcXsrv X server is listening.
Then, in the remote shell: