DEV Community

Discussion on: Linux on Windows: WSL with Desktop Environment via RDP

Collapse
 
rescenic profile image
Muhammad Ridwan Hakim • Edited

In Ubuntu WSL:
sudo apt-get purge xrdp

then

sudo apt-get install xrdp
sudo apt-get install xfce4
sudo apt-get install xfce4-goodies

configure :
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
echo xfce4-session > ~/.xsession

sudo nano /etc/xrdp/startwm.sh
comment these lines to:
#test -x /etc/X11/Xsession && exec /etc/X11/Xsession
#exec /bin/sh /etc/X11/Xsession

add these lines:
# xfce
startxfce4

sudo /etc/init.d/xrdp start

Now in Windows, use Remote Desktop Connection
localhost:3390
then login with Xorg, fill in your username and password.

Collapse
 
r33code profile image
r33

Those instructions did the trick for me. :)
Thank you very much.

Collapse
 
dowenrei profile image
wenrei

Superb, thanks! Editing the startwm.sh file solves the problem of closing the rdp session after entering the login credentials.
FYI: It only works on Ubuntu 20.04, Ubuntu 18 wouldn't work for me

Collapse
 
myrons profile image
Myron

Thank-you. Worked perfectly. :-)

Collapse
 
vinimartins profile image
Vinicius Martins

Thaaaanks! It Worked

Collapse
 
bakaratiq profile image
Mohammad Abubakar Atiq

I just change the port to 3400 i hope it dont effect the server but this error is coming up. Any recommendations?

Thread Thread
 
rescenic profile image
Muhammad Ridwan Hakim

which error?

Collapse
 
raviln profile image
Ravil Nugmanov

Hi,
First I followed original instructions, but after connecting over RDP and entering login credentials, it was closing the RDP session immediately.
Then I run all commands from Ridwan's post, and now it works well!
Thank you Robin and Ridwan!
PS: I have Ubuntu 20.04 installed in WSL 2.

Thread Thread
 
darksmile92 profile image
Robin Kretzschmar

It seems like newer versions of wsl are having this behavior, good that Ridwan shared his solution and you got it working with it 😊

Thread Thread
 
bagoes profile image
bagoes

I have run Ubuntu with xfce on WSL1 using VcXsrv, but can't use the browser. I tried to update Windows to be able to try WSL2, it turns out that xfce could not run due to display problems. Finally here I found the solution by Ridwan, of courser Robin also who made the tutorial thread, as well as other commentators. Thanks.

Collapse
 
asap profile image
S.P.

Thanks, @rescenic ! I had the same problem, you solution works