RustDesk offers a fully open-source solution for remote desktop access—self-hosted, secure, and built with sysadmins in mind.
As privacy concerns grow and control over infrastructure becomes increasingly critical, IT professionals are turning to self-hosted alternatives for remote desktop software. RustDesk emerges as a powerful and transparent solution that allows organizations to manage remote access entirely on their own terms, without relying on cloud intermediaries.
In this article, we explore the components of the RustDesk server, how it compares to other remote desktop solutions, and provide step-by-step guidance for deploying it using Docker or from source.
What is RustDesk Server?
RustDesk is an open-source remote desktop solution that supports end-to-end encrypted connections across platforms. Its server infrastructure allows sysadmins to host the backend required for client communication, offering full data ownership and control.
The server consists of three core binaries:
hbbs
– The ID broker and rendezvous server that manages device IDs and session initiation.hbbr
– The relay server for handling NAT traversal and indirect connections.rustdesk-utils
– CLI utilities including keypair generation.
These components ensure peer-to-peer (P2P) connectivity whenever possible, falling back to relayed communication when necessary.

Deployment Options
1. Quick Deployment with Docker
Basic usage (host networking)
docker run --name hbbs --net=host -v "$PWD/data:/root" -d rustdesk/rustdesk-server:latest hbbs -r <relay-server-ip:21117>
docker run --name hbbr --net=host -v "$PWD/data:/root" -d rustdesk/rustdesk-server:latest hbbr
Note:
--net=host
is required for P2P to function properly.
Port-mapped alternative
docker run --name hbbs -p 21115:21115 -p 21116:21116 -p 21116:21116/udp -p 21118:21118 \
-v "$PWD/data:/root" -d rustdesk/rustdesk-server:latest hbbs -r <relay-server-ip:21117>
docker run --name hbbr -p 21117:21117 -p 21119:21119 \
-v "$PWD/data:/root" -d rustdesk/rustdesk-server:latest hbbr
Using docker-compose
version: '3'
services:
hbbs:
image: rustdesk/rustdesk-server:latest
container_name: hbbs
ports:
- 21115:21115
- 21116:21116
- 21116:21116/udp
- 21118:21118
command: hbbs -r rustdesk.example.com:21117
volumes:
- ./data:/root
restart: unless-stopped
hbbr:
image: rustdesk/rustdesk-server:latest
container_name: hbbr
ports:
- 21117:21117
- 21119:21119
volumes:
- ./data:/root
restart: unless-stopped
2. S6-Overlay Version (All-in-One Container)
This version uses BusyBox and S6-overlay to supervise both hbbs
and hbbr
within a single container:
docker run --name rustdesk-server \
--net=host \
-e "RELAY=relay.example.com" \
-e "ENCRYPTED_ONLY=1" \
-v "$PWD/data:/data" -d rustdesk/rustdesk-server-s6:latest
You can also run it with port mappings instead of host networking if P2P is not required.
Managing Server Keys
RustDesk uses key pairs for encryption. These can be generated using the CLI:
docker run --rm --entrypoint /usr/bin/rustdesk-utils rustdesk/rustdesk-server-s6:latest genkeypair
Example output:
Public Key: iEyskoaYRwLDy5+0qNDqkbPdpxr0kXRSZxNjEsqykyE=
Secret Key: FR2j78IxfwJNR+HjLluQ2Nh7eEryEeIZCwiQDPVe+PaITKyShphHAsPLn7So0OqRs92nGvSRdFJnE2MSyrKTIQ==
You can pass these keys to the container as environment variables or Docker secrets.
Advanced Configuration
The S6 container supports additional environment variables:
Variable | Description |
---|---|
RELAY | IP or hostname of the relay server (hbbr ) |
ENCRYPTED_ONLY | If set to 1 , disallows unencrypted connections |
DB_URL | Path to the SQLite database |
KEY_PUB / KEY_PRIV | Public/private keys for encryption |
These settings allow for hardened, policy-compliant deployments.
Manual Installation from Source
If you prefer compiling the binaries:
git clone https://github.com/rustdesk/rustdesk-server
cd rustdesk-server
cargo build --release
The compiled binaries will be located in target/release
.
Required Ports Overview
Service | Ports (TCP) | Ports (UDP) | Purpose |
---|---|---|---|
hbbs | 21115, 21116, 21118 | 21116 | Session handling, broker |
hbbr | 21117, 21119 | – | Relay and fallback connections |
Ensure these ports are open on your firewall or cloud security group.
Conclusion
RustDesk provides system administrators with a flexible, secure, and cost-effective solution for remote desktop access. Unlike proprietary tools, RustDesk is fully open-source and can be deployed on-premises or in private clouds, offering complete ownership and control over your infrastructure.
Whether you are supporting remote workers, managing edge devices, or replacing commercial alternatives, RustDesk is a viable and modern choice.
You can explore the official project here:
👉 https://github.com/rustdesk/rustdesk-server