RustDesk Remote Desktop Infrastructure: Building a Private, Secure Remote Access Solution
Overview
RustDesk is an open-source, self-hosted remote desktop platform that provides secure and fast peer-to-peer connections between clients without relying on third-party cloud infrastructure. It is a perfect alternative to commercial solutions like TeamViewer or AnyDesk, giving full data ownership and control.
I deployed a RustDesk self-hosted server on my home infrastructure using Docker containers, enabling secure remote access to my devices and virtual machines across my network — including Proxmox, Debian VMs, and remote endpoints.
Objective
The goal of this project was to:
- To have and use one and only cross platform remote desktop solution instead of many different.
- Host my own RustDesk relay (hbbs) and signal (hbbr) servers inside Docker.
- Provide LAN and remote access through a public domain with encryption.
- Allow my devices (computers, tablets, phones) to connect to each other without using RustDesk’s public servers.
- Enable headless server operation (no GUI needed) for efficiency.

Infrastructure Setup
RustDesk server runs on my Debian Server node, alongside other containers such as Prometheus, Grafana, and Wazuh.
The container runs inside a Docker stack, connected to the same management subnet.
Host Environment
- OS: VM Debian 13 server
- Virtualization: Proxmox VE
- Containerization: Docker + Docker Compose
- Network: “Admin” subnet with full access
- Public Access: Cloudflare Tunnel and DNS for domain exposure
Installation Steps
1. Create a Docker Compose File
I created the compose file /opt/rustdesk/docker-compose.yml:
services: hbbs: image: rustdesk/rustdesk-server:latest container_name: rustdesk-hbbs command: hbbs -r hbbr restart: unless-stopped network_mode: host volumes: – /opt/appdata/rustdesk/data:/root environment: – TZ=Europe/Athens hbbr: image: rustdesk/rustdesk-server:latest container_name: rustdesk-hbbr command: hbbr restart: unless-stopped network_mode: host volumes: – /opt/appdata/rustdesk/data:/root environment: – TZ=Europe/Athens
This setup runs both:
- hbbr — the relay server (for actual data transfer),
- hbbs — the signal/broker server (for ID and key registration).
Using network_mode: host simplifies networking since both need access to ports directly.
2. Required Ports
To allow connections, the following ports must be open (or tunneled while using Cloudflare):
| Port | Protocol | Description |
|---|---|---|
| 21115 | TCP | RustDesk relay |
| 21116 | TCP | RustDesk signal |
| 21117 | TCP | Heartbeat service |
| 21118 | TCP | Web console (optional) |
| 21119 | TCP | NAT traversal |
3. Generate Encryption Keys
RustDesk uses an RSA key pair to encrypt communications. Inside the running container, generate the keys:
docker exec -it rustdesk-hbbs bash
hbbs -g
exit
This creates two files inside /opt/rustdesk/data/:
- id_ed25519 (private key)
- id_ed25519.pub (public key)
You will use the public key to configure your RustDesk clients.
Client Configuration
On any client device (Windows, Linux, Android):
1. Open RustDesk settings.

2. Network
-
- Under “ID/Relay Server,” set:
- ID Server: rustdesk.black-crab.cc
- Relay Server: rustdesk.black-crab.cc
- Key: paste the content of id_ed25519.pub
3. Save and restart the client.
4. Repeat on every client (Windows, Linux, Mac, Android, IOS)

Now, all devices connect through my private RustDesk server — bypassing external servers.
Security Considerations
- All traffic between clients and the server is encrypted via TLS and the RSA keypair.
- Hosting RustDesk locally means no third-party data exposure.
- Access is further protected by Cloudflare Zero Trust policies.
Benefits
- Full ownership of connection data and sessions.
- Fast P2P performance within LAN.
- Secure encrypted remote connections via Cloudflare Tunnel.
- Easy deployment and maintenance using Docker.
Conclusion
This project transformed my infrastructure’s remote management capabilities.
RustDesk now acts as a self-hosted, encrypted remote desktop service, allowing seamless access to my Proxmox servers, VMs, and even mobile devices — all under my control.
It’s a lightweight, private, and elegant solution that aligns perfectly with my self-hosted philosophy and automation-first infrastructure.