I have a Raspberry Pi 3 Model B+ connected to my local network and I can SSH into it with no problems. This does cause some problems though as everything is done on the command line.

What I would really like to do is use X11 forwarding by using the SSH client that comes with Windows Subsystem for Linux. I am running Windows 10 Pro with the 1803 update installed.

I'm just curious about how I might go about using this feature? If it won't work in Windows 10 natively then I can always run a Linux virtual machine to connect to the Raspberry Pi.


3 Answers 3


This is definitely possible given your current setup. Note that you also have the option of using Putty but either way, you'll need to have an X server running on the client machine, your Windows Subsystem for Linux — WSL. The client-server model of the X window system is partially what makes X forwarding so easy to pull off. All you need is an X server running on host and client.

Raspberry Pi (Host) Configuration

First, you'll want to make a minor config adjustment to your SSH server on the host machine (your Raspberry Pi). First, find your sshd_config file within the etc directory. You can run these commands by ssh-ing into the Raspberry Pi (with a sudo-capable account), or accessing the Pi directly and then opening a terminal.

Once you're in, run the command:

cd /etc/ssh

Make a backup of your sshd config file:

cp sshd_config sshd_config.ORIG

Now open the original file in a text editor with:

sudo nano sshd_config

You can choose any text editor you're comfortable with (see here for the nano text editor shortcuts). This is the main config file for the ssh server. Find and uncomment the following lines:

X11Forwarding yes
X11UseForwarding yes

Save and exit. Now you'll need to restart your Pi's SSH server with:

sudo systemctl restart sshd

Windows (Client) Setup

You're done with your host. Now all you need to do is install an X server for Windows. There are a few options to choose from but I would go with Cygwin X which you can download here. Install it and once you run it, it should spawn a little window on your client which will be used to display the X program. You can now test that X forwarding is happening by returning to your WSL shell and running the simple command:


A simple clock should appear in the window spawned by Cygwin. You can terminate the clock by returning to your WSL shell and hitting Ctrl+C. If this command isn't recognized, you may first need to install x11-graphics applications on the host machine with:

sudo apt-get install x11-apps

X forwarding should now be enabled for you and you can now run most if not all of your Raspberry Pi's applications from Windows.

Note on XDMCP, FreeNX

You may wish to take things a step further and set things up to run an entire desktop environment from your Pi rather than just app-by-app which is what X forwarding allows. Here are a couple common options available to you:

  • XDMCP: This is the easiest to set up but is notoriously insecure and most authorities only recommend you ever run it on a trusted, wired LAN (like your home network). This may be more trouble than it's worth but if you're curious to look into it, see this Rasp Pi thread for the initial setup.
  • FreeNX: More secure than XDMCP and probably worth the time to set up if you'll want to do this regularly and possibly from another network entirely. You'll need to install a FreeNX server on the host, then use another piece of software - NoMachine - on your Windows client. See here for a very detailed guide.
  • 1
    Thanks for your answer! Could you please specify what shell you meant in "You can now test that X forwarding is happening by returning to your WSL shell"? Is this Bash inside Ubuntu inside Windows, for example? Aug 15, 2019 at 18:59
  • 1
    If I add the line X11UseForwarding yes, the SSH server fails to restart. If I remove it, it restarts successfully. Jan 29, 2021 at 15:20

On the WSL shell, make sure you have exported the fully qualified DISPLAY

export DISPLAY=localhost:0.0

The following does not work:

export DISPLAY=:0.0

:0.0 relies on a UNIX domain socket (instead of a TCP/IP socket) and somehow the X-forwarding doesn't get hooked up correctly. I had the same problem.

update: wsl2 is almost the same, but when using VcXsrv, you must check the disable access control box.

  • What is VcXsrv that you mentioned? Jul 9, 2021 at 23:24
  • VcXsrv is a xwindows server application for windows. Windows11 has a builtin server as part of WSL, so this may not be needed in the future. Just google it.
    – Carl Zmola
    Oct 19, 2021 at 20:19

X11 considers the machine that DISPLAYS the graphical interface to be the X Windows SERVER, and the machine that provides the information to be displayed as the X Windows CLIENT. This is the reverse of the usual client/server relationship. Think of the local machine (the one with the physical display) as the graphics server and the remote machine as the graphics client.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .