How to Install, Configure, and Use RustDesk on Ubuntu (Complete Self-Hosted Remote Desktop Guide)
Last Updated: July 11th, 2026
This comprehensive tutorial shows you how to install, configure, secure, and use RustDesk on an Ubuntu server and client machines. RustDesk is a fully open-source, self-hosted remote desktop software designed to serve as a secure, high-performance alternative to proprietary tools like TeamViewer or AnyDesk, giving you absolute control over your remote connections.
What Is RustDesk?
RustDesk is a secure, open-source remote desktop infrastructure written in the Rust programming language. Commercial remote access solutions route your desktop streams through third-party proprietary relays, introducing latency, subscription paywalls, and privacy risks. By self-hosting the RustDesk ID/Relay server on your private infrastructure and connecting your client devices to it, your remote sessions remain entirely private, fast, and independent of external corporate cloud limits.
RustDesk Features
- 100% Self-Hosted & Private: Run your own rendezvous and relay servers so no connection metadata leaks to external providers.
- High-Performance Rendering: Optimized for smooth desktop streaming, file transfers, and audio redirection.
- Cross-Platform Support: Fully compatible native clients for Linux, Windows, macOS, Android, and iOS.
- Configurable Access Control: Enforce password protections, permission prompts, and address book management.
- Lightweight Server Footprint: Consumes minimal memory and works easily on modest VPS nodes or home lab servers.
Requirements & Prerequisites
You will need an Ubuntu server (22.04, 24.04 LTS, or newer) with administrative sudo privileges and Docker/Docker Compose installed for the self-hosted server backend. You also need open network ports or a reverse proxy configuration to handle RustDesk's rendezvous (21115-21119) and relay (21128, 21129) services.
Step 1: Install Docker and Docker Compose on the Server
The RustDesk server components (hbbs rendezvous server and hbbr relay server) run neatly inside containers. Log into your Ubuntu server and install Docker:
sudo apt update
sudo apt install -y docker.io docker-compose-v2
sudo systemctl start docker
sudo systemctl enable docker
Step 2: Create a Docker Compose Configuration for RustDesk Server
Create a dedicated directory for your RustDesk server deployment and configure your containers:
mkdir -p ~/rustdesk-server && cd ~/rustdesk-server
sudo nano docker-compose.yml
Paste the following complete container configuration into the file:
services:
hbbs:
image: rustdesk/rustdesk-server:latest
container_name: hbbs
command: hbbs -r your-server-ip-or-domain:21117
volumes:
- ./data:/root
ports:
- 21115:21115
- 21116:21116
- 21116:21116/udp
- 21118:21118
restart: always
hbbr:
image: rustdesk/rustdesk-server:latest
container_name: hbbr
command: hbbr
volumes:
- ./data:/root
ports:
- 21117:21117
- 21119:21119
restart: always
Note: Replace your-server-ip-or-domain with your actual public server IP address or domain name. Spin up the containers:
sudo docker compose up -d
Step 3: Retrieve Your Public Key (Encryption Key)
RustDesk generates an encryption key automatically upon initialization. To enforce secure connections where clients must present a key to connect through your server, retrieve the contents of the generated `.pub` key file located in your data volume:
cat ~/rustdesk-server/data/id_ed25519.pub
Copy this key string, as you will input it into your client applications.
Step 4: Installing and Configuring RustDesk on Client Devices
Download and install the official RustDesk application on your local and remote desktop environments from the official website or repository.
- Open the RustDesk application.
- Click the **Menu / Settings button** (represented by three dots or gear icon) next to your ID display in the main window.
- Navigate to the **Network** or **ID Server** configuration tab.
- Input your server details:
- ID Server: Enter your server's public IP address or FQDN (e.g.,
your-server-ip-or-domain). - Key: Paste the public key string retrieved from
id_ed25519.pubin Step 3.
- ID Server: Enter your server's public IP address or FQDN (e.g.,
- Click **Apply** or **Save**. Your client will now register its heartbeat directly with your self-hosted backend.
Step 5: Using RustDesk for Remote Sessions
Once your network configuration points to your custom server:
- Connecting to a Remote Machine: On the machine you wish to control, read the **RustDesk ID** and temporary **Password** displayed on its interface. On your local machine, type that remote ID into the **Desktop ID** box and click **Connect**.
- Authenticating: Enter the remote device's access password when prompted. Once accepted, your high-performance remote graphical stream will open in a dedicated window.
- Using App Features: Use the top control bar inside an active session to toggle image quality adjustments, audio transmission, file transfers, or remote clipboard synchronization.