Enable Remote Desktop with XRDP on Kali Linux
There was a lot of issue with enabling XRDP on my Kali Linux box. I would set it up following the required parameters, but after entering the correct credentials, it would immediately terminate and land me back to my original desktop. Through a lot of trial and error, I’ve figured out that these steps will help anyone facing a similar issue.
Step 1: Ensure that your machine is update.
sudo apt-get update
sudo apt-get uprade
Step 2: Install XRDP
sudo apt-get install xrdp
Step 3: Install tigervnc
to circumvent a bug on XRDP.
sudo apt-get install tigervnc-common
sudo apt-get install tigervnc-scraping-server
sudo apt-get install tigervnc-standalone-server
sudo apt-get install tigervnc-viewer
sudo apt-get install tigervnc-xorg-extension
Step 4: Add the user.
sudo adduser xrdp ssl-cert
Step 5: Create a file xsession and add the following content.
sudo echo xfce4-session > /etc/.xsession
Step 6: We need to make some modifications to the startwm.sh
file.
vim /etc/xrdp/startwm.sh
Step 7: Comment or remove the following lines that can be found towards the end of the document.
test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession
Step 8: Towards the end, add the string startxfce4
and then save the file.
Step 9: Start the XRDP service.
sudo systemctl enable xrdp
sudo systemctl start xrdp
Step 10: You can login now with your RDP client, however, the login should be with incorrect credentials, and you’ll see the following error.
Step 11. Click OK and set the following options as xvnc
from the dropdown and give the CORRECT credentials here.
Step 12: You will now be able to successfully login.