Remote Desktop Setup for Ubuntu 24.04 AWS EC2¶
This guide explains how to set up remote desktop access on an Ubuntu 24.04 AWS EC2 instance so you can connect from a Windows machine.
System Information¶
This setup is tested on:
- OS: Ubuntu 24.04 LTS (AWS EC2)
- Architecture: x86_64
- Kernel: Linux 6.14.0-1011-aws
Option 1: XRDP (Recommended for Windows RDP)¶
XRDP allows you to use Windows' built-in Remote Desktop Connection to connect to your Ubuntu machine.
Installation Steps¶
- Update the system:
- Install desktop environment (XFCE - lightweight):
- Install XRDP:
- Configure XRDP to use XFCE:
- Start and enable XRDP service:
- Configure firewall (if ufw is enabled):
- Set password for ubuntu user:
Install Firefox Browser¶
Option 2: VNC Server (Alternative)¶
VNC provides cross-platform remote desktop access but requires a separate VNC client.
Installation Steps¶
- Install VNC server and desktop:
sudo apt update
sudo apt install -y ubuntu-desktop-minimal tigervnc-standalone-server tigervnc-common
- Set VNC password:
- Start VNC server:
- Configure firewall:
AWS Security Group Configuration¶
Important: You must configure your AWS Security Group to allow remote desktop connections.
- Go to AWS Console → EC2 → Security Groups
- Select your instance's security group
- Add inbound rule:
- For XRDP:
- Type: Custom TCP
- Port: 3389
- Source: Your IP address (for security)
- For VNC:
- Type: Custom TCP
- Port: 5901
- Source: Your IP address (for security)
Connecting from Windows¶
Using XRDP (Option 1)¶
- Open "Remote Desktop Connection" (built into Windows)
- Computer:
your-ec2-hostname:3389oryour-ec2-public-ip:3389 - Username:
ubuntu - Password: The password you set with
sudo passwd ubuntu
Using VNC (Option 2)¶
- Install a VNC client (like RealVNC Viewer)
- Connect to:
your-ec2-hostname:5901oryour-ec2-public-ip:5901 - Enter the VNC password you set with
vncpasswd
Troubleshooting¶
XRDP Issues¶
- Black screen: Make sure you set the session with
echo "xfce4-session" > ~/.xsession - Connection refused: Check if XRDP is running:
sudo systemctl status xrdp - Can't connect: Verify AWS Security Group allows port 3389
VNC Issues¶
- Display not found: Start VNC server with
vncserver :1 - Connection timeout: Check AWS Security Group allows port 5901
- Poor performance: Try reducing color depth:
vncserver :1 -depth 16
General Network Issues¶
- Verify your EC2 instance's public IP hasn't changed
- Check that your home/office IP is allowed in the security group
- Ensure the EC2 instance is running and accessible via SSH
Security Considerations¶
- Limit source IPs: Always restrict remote desktop access to your specific IP addresses
- Use strong passwords: Set complex passwords for user accounts
- Consider VPN: For production environments, consider accessing through a VPN
- Disable when not needed: Stop XRDP/VNC services when not in use:
Performance Tips¶
- XFCE is lightweight: We chose XFCE desktop environment for better performance over RDP
- Adjust resolution: Use appropriate screen resolution for your connection speed
- Close unused applications: Remote desktop uses bandwidth, so close unnecessary programs
- Use compression: Some RDP clients offer compression options for slower connections