RustDesk Server
Self-hosted remote desktop infrastructure, TeamViewer/AnyDesk alternative.
Overview
RustDesk is an open-source remote desktop solution that provides a self-hosted alternative to proprietary services like TeamViewer and AnyDesk. Originally developed as a cross-platform remote desktop client, RustDesk includes server components that enable organizations to maintain complete control over their remote access infrastructure, eliminating reliance on third-party services and ensuring sensitive data never leaves their network perimeter. The server implementation consists of two primary components: hbbs (ID/rendezvous server) and hbbr (relay server), which work in tandem to facilitate secure peer-to-peer connections.
The hbbs component functions as the central coordination hub, managing client registration, authentication, and initial connection brokering between remote desktop sessions. Meanwhile, hbbr serves as the relay server that handles NAT traversal and maintains connections when direct peer-to-peer communication isn't possible due to network configurations or firewall restrictions. This dual-server architecture ensures reliable connectivity across diverse network topologies while maintaining the performance benefits of direct connections whenever feasible.
This stack is particularly valuable for organizations requiring compliance with data residency regulations, companies with stringent security policies that prohibit external remote access services, and technical teams seeking customizable remote desktop solutions. System administrators managing distributed teams, MSPs providing remote support services, and privacy-conscious users who prefer self-hosted alternatives will find this configuration essential for maintaining secure, auditable remote access capabilities without subscription costs or external dependencies.
Key Features
- Ed25519 cryptographic key-based authentication for tamper-resistant client verification
- Mandatory encryption enforcement preventing unencrypted remote desktop sessions
- Automatic NAT traversal through dedicated relay server for complex network topologies
- Cross-platform client support including Windows, macOS, Linux, iOS, and Android
- Direct peer-to-peer connections bypassing relay when network conditions permit
- Centralized connection logging and session management through hbbs coordination
- Custom server configuration allowing white-label deployment for service providers
- UDP and TCP dual-protocol support optimizing performance based on network conditions
Common Use Cases
- 1Enterprise IT departments replacing TeamViewer subscriptions with self-hosted remote support
- 2Managed service providers offering branded remote desktop access to clients
- 3Educational institutions providing secure remote lab access to students and faculty
- 4Healthcare organizations ensuring HIPAA-compliant remote workstation access
- 5Financial services maintaining SOX compliance while enabling remote work capabilities
- 6Government agencies requiring air-gapped remote desktop infrastructure
- 7Software development teams accessing development servers and testing environments securely
Prerequisites
- Docker Engine 20.10+ and Docker Compose V2 for container orchestration support
- Minimum 512MB RAM allocation for both hbbs and hbbr server processes
- Available ports 21115-21119 for client connections and inter-service communication
- Static IP address or dynamic DNS configuration for client endpoint discovery
- Firewall rules permitting inbound UDP/TCP traffic on designated RustDesk ports
- SSL certificate management strategy for production deployments with custom domains
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 hbbs: 3 image: rustdesk/rustdesk-server:latest4 container_name: rustdesk-hbbs5 command: hbbs6 environment: 7 - ENCRYPTED_ONLY=18 volumes: 9 - rustdesk-data:/root10 ports: 11 - "21115:21115"12 - "21116:21116"13 - "21116:21116/udp"14 - "21118:21118"15 networks: 16 - rustdesk-network17 restart: unless-stopped1819 hbbr: 20 image: rustdesk/rustdesk-server:latest21 container_name: rustdesk-hbbr22 command: hbbr23 volumes: 24 - rustdesk-data:/root25 ports: 26 - "21117:21117"27 - "21119:21119"28 networks: 29 - rustdesk-network30 restart: unless-stopped3132volumes: 33 rustdesk-data: 3435networks: 36 rustdesk-network: 37 driver: bridge.env Template
.env
1# RustDesk Server2# Public key will be generated in rustdesk-data volume3# Configure clients with your server IP and public keyUsage Notes
- 1ID server (hbbs) handles connections
- 2Relay server (hbbr) for NAT traversal
- 3Get public key from data/id_ed25519.pub
- 4Configure clients with server IP + key
- 5Encrypted connections only
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
hbbs
hbbs:
image: rustdesk/rustdesk-server:latest
container_name: rustdesk-hbbs
command: hbbs
environment:
- ENCRYPTED_ONLY=1
volumes:
- rustdesk-data:/root
ports:
- "21115:21115"
- "21116:21116"
- 21116:21116/udp
- "21118:21118"
networks:
- rustdesk-network
restart: unless-stopped
hbbr
hbbr:
image: rustdesk/rustdesk-server:latest
container_name: rustdesk-hbbr
command: hbbr
volumes:
- rustdesk-data:/root
ports:
- "21117:21117"
- "21119:21119"
networks:
- rustdesk-network
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 hbbs:5 image: rustdesk/rustdesk-server:latest6 container_name: rustdesk-hbbs7 command: hbbs8 environment:9 - ENCRYPTED_ONLY=110 volumes:11 - rustdesk-data:/root12 ports:13 - "21115:21115"14 - "21116:21116"15 - "21116:21116/udp"16 - "21118:21118"17 networks:18 - rustdesk-network19 restart: unless-stopped2021 hbbr:22 image: rustdesk/rustdesk-server:latest23 container_name: rustdesk-hbbr24 command: hbbr25 volumes:26 - rustdesk-data:/root27 ports:28 - "21117:21117"29 - "21119:21119"30 networks:31 - rustdesk-network32 restart: unless-stopped3334volumes:35 rustdesk-data:3637networks:38 rustdesk-network:39 driver: bridge40EOF4142# 2. Create the .env file43cat > .env << 'EOF'44# RustDesk Server45# Public key will be generated in rustdesk-data volume46# Configure clients with your server IP and public key47EOF4849# 3. Start the services50docker compose up -d5152# 4. View logs53docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/rustdesk-server/run | bashTroubleshooting
- Clients cannot discover server: Verify ports 21115-21116 are accessible and DNS resolution points to correct server IP address
- Connection established but screen sharing fails: Check that port 21117 (relay server) is properly forwarded and hbbr container is running
- Authentication failures with correct key: Ensure ENCRYPTED_ONLY=1 is set and clients are using the public key from id_ed25519.pub file
- High CPU usage on relay server: Monitor concurrent connections and consider scaling hbbr instances for environments exceeding 50 simultaneous sessions
- Intermittent disconnections during sessions: Verify UDP port 21116 is not blocked by ISP or corporate firewall policies
- Unable to retrieve public key for client configuration: Check that rustdesk-data volume is properly mounted and containers have write access to /root directory
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
rustdesk-serverrustdesk-relay
Tags
#remote-desktop#rustdesk#self-hosted#teamviewer-alternative
Category
Home Lab & Self-HostingAd Space
Shortcuts: C CopyF FavoriteD Download