I have a laptop running Windows 10 (or Windows 11). I can ssh
into my Ubuntu computer with ssh [email protected]
, but I'd like to either (a) use a GUI app from Windows or (b) use the entire desktop from Windows. Ideally, I'd like to do this via X forwarding, rather than VNC or RDP. Note that I'm not using Wayland here.
How can I do this?
I'll start with two machines. I'll have a recent (22H2) Windows 10 computer and a Ubuntu 23.04 machine. The Ubuntu machine will run stock Ubuntu desktop. I'll be using a minimal install of Ubuntu, but a full installation should work fine to. I further assume that your Ubuntu computer has been configured to run Xorg, not Wayland. This is not the default.
On the Windows machine, download VcXsrv from here, and run the installer. At the time of writing, the file was called
vcxsrv-64.1.20.14.0.installer.exe
. The version will likely vary over time, though. In the VcXsrv installer, accept the defaults, they are fine.On Ubuntu, run
sudo apt update && sudo apt install openssh-server
. Runhostname -I
to find your IP address. Let's pick an app to run remotely. I'll choose/usr/bin/gnome-text-edit
. On the actual Ubuntu computer (i.e., not over SSH), run/usr/bin/gnome-text-edit
. The text editor should open. Close it. We just needed to ensure it worked.Let's try that from Windows, via SSH. In Windows, run
ssh -X username@[Ubuntu IP address here]
. That either gave an error like(gnome-text-editor:2524): Gtk-WARNING **: 12:51:24.488: cannot open display:
. That wasn't what we wanted. If it opened the text editor, but on the Ubuntu computer, double-check that you're not using Wayland. On Windows, run XLaunch (it's an app, not a shell command). That is what was installed by the VcXsrv installer. SelectMultiple windows
, and a Display number of three (3
). SelectStart no client
, and checkDisable access control
, and do Finish.Find the IP address of your Windows computer by running
ipconfig
in the terminal (I'm using Powershell). My Windows IP is192.168.1.141
. Now doin the SSH session. The app should launch on Windows. Note that
192.168.1.141
is the IP of your Windows computer, not your Ubuntu computer.Done! You should be able to do the same thing with any GUI app. Note that this works on Xorg, not Wayland. Also note that I choose a display number of three somewhat randomly. Avoid using one that's already taken, so I picked three, but other numbers that aren't in use should work fine.