How did I connect to Ubuntu 18.04 Xfce 4 desktop from Windows 7 via xrdp?

Step 1

aptitude install xrdp

Step 2

aptitude install xfce4

Step 3

echo xfce4-session > ~/.xsession

Step 4

I have changed the /etc/xrdp/startwm.sh file:

Step 4.1

I have removed the following lines:

test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

Step 4.2

I have added the following line to the end:

startxfce4

Step 5

service xrdp restart

Step 6

Then I have connected to Ubuntu 18.04 desktop from using the «Remote Desktop» application in Windows 7.

See also: How did I connect to Ubuntu 18.04 MATE desktop from Windows 7?

Thank you. This solution worked for me. It resolved my issue connecting from Windows 10 to Ubuntu 20.04 via xrdp and xorg where the session would instantly close after login without these steps (specifically those to modify the startwm.sh script).

Cheers.