WSL2 continues to be one of my top features I want to explore and learn more about in the entire Windows 10 offering. What Microsoft is doing with WSL is fascinating and the endless possibility of having Linux and Windows in such deep marriage is beyond my wildest dream.
In today’s guide, we will use Window’s native RDP client to remote connect into your local WSL2 Ubuntu on the same machine. (when is the last time you RDP into localhost? … and the destination is also running in Linux, not Windows) This never happened to me until just recently. Below is a sneak peek of the end result. Let’s get started.

We assume by now you already have WSL2 running and have at least Ubuntu installed. You can follow this guide to upgrade your Ubuntu to the latest 20.04 LTS distro if you haven’t already done so.
First the standard
sudo apt update && sudo apt -y upgrade
Next we are going to install a GUI distro to Ubuntu
sudo apt-get install -y kubuntu-desktop
Half way through the installation you will be prompt for this configurating sddm, select lightdm

Install and configure XDRP, and change the RDP port to 3390
# install xrdp
sudo apt-get install xrdp
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
Lastly, enable Dbus
#enable dbus
sudo systemctl enable dbus
sudo /etc/init.d/dbus start
sudo /etc/init.d/xrdp start
# check xrdp status
sudo /etc/init.d/xrdp status
You should see something like this below.

Now launch your Windows Remote Desktop Connection, or mstsc
from the Windows Start menu.

enter localhost:3390
and connect. You will be prompt by this screen keep the session as xorg, and enter your WSL2 username and password.

That’s it, you are now connected to your WSL2 Ubuntu with a GUI over Windows’ native RDP client. How crazy is this?!
All above steps went well
RDP is crashing!
any idea?
what do you mean by RDP is crashing? what do you see on the screen? any error messages?
Same for me
—————————————————-
Note: lines starting with “>” are terminal commands
—————————————————-
If xrdp is running, stop it via:
> sudo /etc/init.d/xrdp stop
Edit the startwm.sh file:
> sudo nano /etc/xrdp/startwm.sh
Comment out the following two lines by adding a “#” at the beginning of each line:
test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession
Below the now commented lines, add:
startxfce4
Save the file, start xrdp with
> sudo /etc/init.d/xrdp start
Now you should be able to start the remote desktop session on windows and login with your linux username and password
Great!!! My xfce is running ok now with this tip. Thanks
thank you. the tips work!
—————————————————-
Note: lines starting with “>” are terminal commands
—————————————————-
If xrdp is running, stop it via:
> sudo /etc/init.d/xrdp stop
Edit the startwm.sh file:
> sudo nano /etc/xrdp/startwm.sh
Comment out the following two lines by adding a “#” at the beginning of each line:
test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession
Below the now commented lines, add:
startxfce4
Save the file, start xrdp with
> sudo /etc/init.d/xrdp start
Now you should be able to start the remote desktop session on windows and login with your linux username and password 🙂
After installing the following:
$sudo apt install xfce4 xfce4-goodies
follow every step from author then remote desktop works perfectly. You also can use VNC Viewer from
other computers or phone.
follow the reference:
How to Install and Configure VNC on Ubuntu 20.04
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-20-04
Remote connection is getting authorized but immediately getting closed.
@Julius’ method can solve this problem!
where are my files being saved to on my windows pc with this method?