Introduction
Remote Desktop Protocol (RDP) enables users to establish secure connections to remote computers over a network.
Microsoft developed RDP primarily for Windows, but it can also be used to connect to Linux, macOS, Android, and iOS devices.
Find out how to seamlessly connect to an Ubuntu system from Windows using RDP.
Prerequisites
- A client Windows machine with network connectivity.
- A host machine with Ubuntu 22.04 or Ubuntu 20.04 installed.
- Sudo or root privileges on the host machine.
How to Connect to Ubuntu Remote Desktop From Windows
The RDP client is preinstalled on Windows. However, the Ubuntu system must be configured before it can accept incoming RDP connections.
Install xrdp on Ubuntu
xrdp is an RDP server for Linux that listens for and accepts RDP connections from clients. Ubuntu systems typically do not have xrdp installed by default.
To install xrdp on Ubuntu 22.04:
1. Access the command line and update the Ubuntu packages list:
sudo apt update
2. Install xrdp using the following command:
sudo apt install xrdp -y
3. Check the status of the xrdp server:
sudo systemctl status xrdp
The output confirms the xrdp server is active.
Configure xrdp Port (Optional)
The <strong>xrdp</strong>
server listens for incoming RDP connections on port number 3389. Using a non-standard port for RDP connection is a form of protection through obscurity. It is not a robust security measure, but can protect a system from rudimentary brute-force attacks.
To instruct xrdp to listen on a different port:
1. Use a text editor, like nano, to edit the xrdp configuration file, xrdp.ini:
sudo nano /etc/xrdp/xrdp.ini
2. Locate the port
directive in the [Globals] section and set the desired value. In this example, the RDP port is 49952
:
port=49952
3. Press Ctrl+X, followed by y, and then Enter to save the changes and exit the file.
4. Restart the xrdp server to apply the changes:
sudo systemctl restart xrdp
There is no confirmation message or output after the server is restarted.
Open a Port for Incoming Traffic in ufw
An active firewall on the Ubuntu system, such as ufw, can block traffic on specific ports. Configure the firewall and allow traffic on the desired port to ensure successful RDP connections.
Note: Several tools can help you check open ports in Linux.
1. Check the status of the ufw firewall:
sudo ufw status
If the firewall is inactive, use the following command to turn on ufw:
sudo ufw enable
2. Allow traffic on port 3389
or choose a different port for your RDP connection. The following command allows RDP connections on port 49952
:
sudo ufw allow 49952/tcp
Modify the command if you want to open a different port number for RDP connections.
3. Reload the ufw firewall tool to apply the changes:
sudo ufw reload
Note: If you want to access the Ubuntu machine from outside its local network, you might need to configure port forwarding on the router or adjust external firewalls.
Configure Remote Desktop Connection on Windows
To initiate an RDP connection to a remote Ubuntu system from Windows:
1. Type rdp in the Windows search box.
2. Open the Remote Desktop Connection app.
3. Enter the IP address or name of the remote Ubuntu system in the Computer field. If you changed the default port number for RDP connections on Ubuntu, enter the port number after the IP address in the following format:
IP_address:port_number
Note: Consult the following article if you need help finding IP addresses in Linux.
4. Type the username of the Ubuntu user for the RDP connection.
5. (Optional) Save the connection details for future use.
6. (Optional) The Remote Desktop Connection (RDP) app in Windows enables users to configure the RDP session. The main configuration options are split into several tabs:
- Display. Adjust the size and color settings of the remote desktop window.
- Local Resources. Decide which local devices (keyboards, audio, and printers) to share with the remote system.
- Experience. Modify visual effects like desktop background and font smoothing based on network speeds.
- Advanced. Fine-tune server authentication settings, set up a Remote Desktop Gateway server, and more.
7. Click Connect.
Login
Enter the password for the Ubuntu RDP user and click OK.
You can now interact with the Ubuntu machine via the established RDP session.
Ubuntu RDP From Windows: Extra Tips + Best Practices
Minimum vs. Optimal Hardware Requirements
The RDP connection quality from Windows to Ubuntu primarily depends on the RDP server software (xrdp) and the type of tasks and applications running on the Ubuntu system. The Ubuntu system should meet the following requirements:
REQUIREMENTS | MINIMAL | RECOMMENDED |
---|---|---|
CPU | Single-core 1 GHz+ | Dual-core 2 GHz+ |
RAM | 2 GB+ | 4 GB+ |
Storage | 25 GB+ | 50 GB+ (SSD) |
Network | Basic NIC | Stable broadband (Ethernet NIC) |
Graphics | Integrated graphics or entry-level GPU | Advanced GPU |
Ideal Internet Speed for RDP Connections
Certain tasks require a minimal level of responsiveness and visual quality. The table offers an overview of minimal and recommended bandwidth per connection for general RDP tasks:
LOCAL NETWORK | INTERNET | |
---|---|---|
Text Editing | 1 Mbps | 512 Kbps-1 Mbps |
Web Browsing | 2-5 Mbps | 1-2 Mbps |
Video Streaming | 5-10 Mbps | 3-5 Mbps |
Besides bandwidth, server loads and network latency affect RDP performance. Test the RDP performance under typical work conditions and adjust settings as needed to balance visuals and responsiveness.
xrdp Black Screen Issue Troubleshooting
Users may encounter a black screen when using xrdp with specific Ubuntu configurations. The screen appears after an RDP session has been successfully established and prevents users from interacting with the Ubuntu system.
To try and resolve the black screen issue:
Check Log Files
Log files can provide valuable information about potential errors. Access the /var/log/xrdp.log using the following command:
sudo nano /var/log/xrdp.log
Look for warnings and error messages on the log timeline.
The /var/log/xrdp-sesman.log file contains entries about session startups and shutdowns, operational messages, and warnings. Use the following command to access the log:
sudo nano /var/log/xrdp-sesman.log
Check for errors occurring when a new session is initiated and for other backend-related issues.
Set max_bpp in xrdp.ini File
The bits per pixel value defines the number of bits used to represent the color of a single pixel. High bpp values increase the amount of data that needs to be transferred and can affect performance and cause compatibility issues.
Use the following command to access the xrdp.ini configuration file and check the max_bpp
value:
sudo nano /etc/xrdp/xrdp.ini
Set the max_bpp
value in the [Globals] section to 24
, as the default value of 32
bpp can cause issues. If there are other max_bpp
values under individual sections, adjust them as well.
Save the changes and restart the xrdp service to ensure the changes take effect.
Reinstall xrdp
Reinstalling xrdp is a straightforward and quick way to resolve configuration or compatibility issues.
Enter the following command to remove the xrdp package and delete its configuration files:
sudo apt remove --purge xrdp -y
Initiate a fresh xrdp installation from Ubuntu repositories using the following command:
sudo apt install xrdp -y
After the installation, you need to modify the xrdp configuration files once again.
Install a Different Desktop Environment
The default Ubuntu GNOME desktop occasionally has compatibility issues with xrdp. Install an alternative Ubuntu GUI, such as the XFCE desktop environment, and attempt to establish an RDP connection.
Security Measures
To secure an RDP session from Windows to Linux:
Secure Windows
- Update Windows regularly to ensure the Remote Desktop Connection app is up-to-date with the latest security patches.
- Limit the number of simultaneous active RDP sessions.
- Disconnect from an RDP session when it is not being used and set timeouts for idle sessions.
Secure Network
- Use a firewall to restrict RDP access to specific IP addresses.
- Change the default RDP port (3389) to a non-standard port number.
- Use a VPN to encrypt the data transfer between client and host machines.
- Alternatively, use SSH port forwarding to create an encrypted tunnel for the RDP session if a VPN is not an option.
Secure Linux
- If you use xrdp, edit the /etc/xrdp/sesman.ini file to specify which users can establish an RDP connection.
- Create dedicated accounts for RDP to restrict access to critical systems or data.
- Implement two-factor authentication for RDP sessions. xrdp does not natively support 2FA but can be integrated with other authentication tools.
- Temporarily lock user accounts after multiple unsuccessful login attempts.
- Enforce strong password policies for RDP user accounts.
Note: To ensure your passwords meet the highest security standards, check out our selection of strong password ideas or use our free password generator.
Reduce Resolution & Color Depth for Performance Boost
You can enhance the performance of the RDP session by adjusting the color depth and screen size from the Windows RDP client.
To reduce the resolution and color depth, access the Remote Desktop Connection app:
1. Open the Display tab.
2. Drag the Display configuration slider left to reduce the resolution.
3. Expand the dropdown in the Colors section and choose High Color (16 bit) to reduce the color depth.
Reducing the screen size and color depth is especially beneficial for low-bandwidth or unreliable network connections.
Conclusion
You have successfully initiated an RDP session from your Windows system to a remote Ubuntu machine.
Next, learn how to use xRDP to access Debian from Windows.