What Is RustDesk?
RustDesk is an open-source remote desktop software written in Rust, designed as a self-hostable alternative to TeamViewer and AnyDesk. Unlike commercial solutions where every session passes through the vendor's servers, RustDesk lets you install a relay server on your own VPS, putting full control of your data in your hands.
Quick summary: RustDesk = open-source remote desktop supporting Windows, macOS, Linux, Android, iOS — self-host the relay server on your VPS, data never leaves your infrastructure, free for personal and commercial use.
Why Self-Host Your Own RustDesk Server?
Using RustDesk's public relay servers comes with several drawbacks. First, high latency because the relay is located overseas — hosting your own VPS in Thailand or Singapore dramatically reduces this. Second, privacy: every session traverses a foreign relay, which is unsuitable for sensitive workloads. Third, commercial use through public relays may violate terms of service, while self-hosting has no such restriction. Fourth, stability: public servers handle many users, while self-hosting dedicates full throughput to your team.
RustDesk Server Components
RustDesk Server consists of two main services: hbbs (ID/Rendezvous Server) acts as a registration server for all clients, manages device IDs, and assists with NAT hole punching so both sides can connect directly. hbbr (Relay Server) relays traffic when a direct connection isn't possible (e.g., symmetric NAT on both sides). Both services work together and can be deployed on a single VPS.
| Service | Port | Protocol | Purpose |
|---|---|---|---|
| hbbs | 21115 | TCP | NAT type test |
| hbbs | 21116 | TCP/UDP | ID registration + hole punching |
| hbbr | 21117 | TCP | Relay traffic |
| hbbr | 21118 | TCP | Web client (WebSocket) |
| hbbr | 21119 | TCP | Web client secure (WSS) |
Prerequisites
Before starting, make sure you have: (1) a VPS running Ubuntu 22.04 LTS or Debian 11+ with root access; (2) a public IP reachable from outside — not behind CGNAT; (3) Docker and Docker Compose installed; (4) nothing using ports 21115–21119 yet — verify with ss -tlnp | grep 2111; (5) any existing firewall configured to allow those ports.
Install Docker and Docker Compose
If Docker isn't installed yet:
curl -fsSL https://get.docker.com | sh systemctl enable docker systemctl start docker
Verify Docker is working:
docker --version docker compose version
Deploy RustDesk Server with Docker Compose
Create the directory for RustDesk Server:
mkdir -p /opt/rustdesk cd /opt/rustdesk
Create docker-compose.yml:
version: "3"
services:
hbbs:
container_name: hbbs
image: rustdesk/rustdesk-server:latest
command: hbbs
volumes:
- ./data:/root
network_mode: "host"
depends_on:
- hbbr
restart: unless-stopped
hbbr:
container_name: hbbr
image: rustdesk/rustdesk-server:latest
command: hbbr
volumes:
- ./data:/root
network_mode: "host"
restart: unless-stopped
Create the data directory and start the services:
mkdir -p /opt/rustdesk/data cd /opt/rustdesk docker compose up -d
Verify containers are running:
docker compose ps docker compose logs -f
Note: Using network_mode: "host" gives the container direct access to the host's ports — this is RustDesk's recommended approach for hbbs/hbbr because UDP on port 21116 is required for NAT hole punching.
Retrieve the Server's Public Key
On first startup, hbbs automatically generates a key pair in /opt/rustdesk/data/. View the public key:
cat /opt/rustdesk/data/id_ed25519.pub
Save this value — you'll need it when configuring the RustDesk client to use your private server. Without it, clients can connect but without encryption verification.
Configure UFW Firewall
Open the required ports for RustDesk:
ufw allow 21115/tcp ufw allow 21116/tcp ufw allow 21116/udp ufw allow 21117/tcp ufw allow 21118/tcp ufw allow 21119/tcp ufw reload ufw status
Important: Port 21116 must be opened for both TCP and UDP. hbbs uses TCP for ID registration and UDP for NAT hole punching. Opening only TCP will cause some connections to fail or always use the relay.
Configure RustDesk Client to Use Your Server
Open the RustDesk app on the machine you want to control remotely, go to Settings → Network, and configure:
- ID/Relay Server: Enter your VPS IP or domain, e.g.
123.456.789.012 - Key: Paste the public key from
id_ed25519.pub - API Server: Leave blank (only needed for RustDesk Pro)
Click Apply and restart the app. The client will display a new ID, indicating it has registered with your server. Repeat on every machine you want to include.
Test the Connection
Confirm that hbbs is receiving connections from clients:
docker compose logs hbbs | tail -20
Log entries like registered peer or new connection confirm the client is talking to your server. Test remote control between two machines by entering the target machine's ID in RustDesk and clicking Connect. The first attempt requires the target to accept the incoming request.
Troubleshooting
Work through this checklist if the connection fails: (1) docker compose ps — both hbbs and hbbr must show status Up; (2) ufw status — all five ports must be open; (3) if the VPS sits behind a provider-level security group or firewall, open the ports there too; (4) confirm the client has the correct IP and key, then click Apply and restart the app; (5) docker compose logs hbbr to look for relay errors.
Automatic Restart After Reboot
The restart: unless-stopped policy in Docker Compose handles container restarts. To ensure Docker itself starts on reboot:
systemctl enable docker
Updating RustDesk Server
When a new version is available, pull the latest image and recreate the containers:
cd /opt/rustdesk docker compose pull docker compose up -d
AsiaGB VPS tip: AsiaGB VPS with SSD storage is ideal for RustDesk Server — low latency to Thailand and Singapore, while hbbs + hbbr use only about 50–100 MB of RAM. The entry-level Linux plan at 500 THB/month is more than enough for most teams.
Summary
You now have a fully operational RustDesk Server on your VPS, with both hbbs (ID server) and hbbr (relay) ready to serve clients on every platform. Self-hosting delivers lower latency, full data ownership, and no limits on users or concurrent sessions. RustDesk Server is 100% open-source and free. Running it on an AsiaGB VPS datacenter in Thailand or Singapore provides a noticeably smoother remote desktop experience compared to relying on overseas public relays.
Frequently Asked Questions
How much RAM and CPU does RustDesk Server need?
For small to medium teams (1–50 users), a VPS with 1 vCPU and 1 GB RAM is sufficient. hbbs and hbbr consume very little resources. For more than 100 concurrent users, 2 vCPU and 2 GB RAM is recommended.
Does RustDesk Server support Windows clients?
Yes. RustDesk has clients for Windows, macOS, Linux, Android and iOS. All platforms can connect to the same server. Simply configure the ID/relay server in client settings to point to your VPS IP address.
Where does remote session data go if I don't self-host?
Without a self-hosted server, clients connect through RustDesk's public relay servers located overseas. This can cause high latency, data stored on foreign servers, and potential commercial use restrictions. Self-hosting on a Thai or Singapore VPS solves all of these issues.
Can RustDesk Server be used commercially?
RustDesk OSS (open-source server) is free to use, including for commercial use within your organization (self-hosted). RustDesk Pro adds features like a Web Console and User Management, but OSS is sufficient for most teams.
Get Started with AsiaGB VPS Today
AsiaGB VPS uses SSD storage on every plan. Choose Thailand or Singapore datacenter. Full root access from 500 THB/month (Linux). Thai-language support team available.
View VPS Plans