Ubuntu XRDP

https://cloud.tencent.com/developer/article/2355160

XRDP is a cross-platform remote desktop connection tool that can be used on Windows and Linux . Using XRDP on Ubuntu allows you to remotely connect to a Linux server from a Windows computer for file transfer, remote control, and other operations.

Install XRDP

First, you need to install XRDP on Ubuntu. Open the terminal and enter the following command to install it:

sudo apt updatesudo apt install xrdp

After the installation is complete, you can check whether XRDP was successfully installed by entering the following command:

xrdp --version

Black screen when connecting

This problem is that if you do not log out of your local computer, the remote desktop will be black. The best solution is to log out of the local computer, which is to log out. This method will definitely work. Unlike the perfect remote control of Windows, in Ubuntu, local login and remote login are separated. If you log in remotely and do not log out, the local screen will be black. Conversely, if you log in locally and do not log out, the remote screen will be black. It is the option put together with shutdown and restart.

Desktop Optimization

Note that you must modify the following configuration file before connecting remotely, otherwise the screen will go black and you will need to restart.

Anyway, remember one thing: if you do not log in locally after restarting, the remote screen will not be black!

If you don’t do any configuration, the desktop after startup is very awkward, because it is the original desktop of Gnome , there is no taskbar on the left, the window has no minimize button, and so on. The solution is also very simple:

1. Add a configuration file

vim ~/.xsessionrc

# Add

export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg

2. Restart the xrdp service

sudo systemctl restart xrdp.service

If you connect again at this time, you will get exactly the same effect as the native desktop!

Xrdp experience optimization to reduce/solve screen freezes

Adjusting Xrdp Configuration Parameters

Edit /etc/xrdp/xrdp.ini

tcp_send_buffer_bytes=4194304
tcp_recv_buffer_bytes=6291456

The two parameters tcp_send_buffer_bytes and tcp_recv_buffer_bytes are commented out by default, with the default value (32768) being commented out. Adjust according to the actual situation.

Adjust system parameters

Temporary effect

sudo sysctl -w net.core.rmem_max=12582912
sudo sysctl -w net.core.wmem_max=8388608

Retain after reboot

Write the following content to the configuration file /etc/sysctl.conf

net.core.rmem_max = 12582912
net.core.wmem_max = 8388608

Then execute

sudo sysctl -p

Restart the xrdp service to take effect

sudo systemctl restart xrdp

Leave a Reply

Your email address will not be published. Required fields are marked *