1. Install XRDP
First, install XRDP on Ubuntu by opening the terminal and entering:
sudo apt update
sudo apt install xrdp
2. Verify XRDP Installation
Check if XRDP is installed successfully:
xrdp --version
3. Black Screen Issue
If the remote desktop shows a black screen, log out of the local session or follow these steps:
Edit /etc/xrdp/startwm.sh
and add:
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
Restart XRDP service:
sudo systemctl restart xrdp.service
4. Desktop Optimization
Modify the following configuration file before remote connection:
Create ~/.xsessionrc
and add:
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
Restart XRDP service:
sudo systemctl restart xrdp.service
5. XRDP Performance Optimization
Adjust XRDP configuration parameters by editing /etc/xrdp/xrdp.ini
and set:
tcp_send_buffer_bytes=4194304
tcp_recv_buffer_bytes=6291456
Adjust system parameters:
sudo sysctl -w net.core.rmem_max=12582912
sudo sysctl -w net.core.wmem_max=8388608
Make changes permanent by adding to /etc/sysctl.conf
:
net.core.rmem_max = 12582912
net.core.wmem_max = 8388608
Execute:
sudo sysctl -p
Restart XRDP service:
sudo systemctl restart xrdp