RustDesk Remote Desktop Self-hosted Server

Words 539
Views
Visitors

Timeline

Timeline

2025-03-14

init

This article describes how to self-host a RustDesk remote desktop server to replace the limitations of the ToDesk free version. It details the complete process of deploying an ID/relay server on Ubuntu via Docker, including installing Docker and docker-compose-plugin, writing a docker-compose.yaml file, opening required ports, and other steps. It also explains how to install RustDesk on Windows clients, configure the ID server and relay server IP, fill in the key, and finally achieve remote connection using the ID and password. This solution is free and offers better frame rate and resolution than the ToDesk free version.

After using ToDesk for a few days, because I never shut down the computer, I used up all the quota in the middle of the month and was not allowed to continue using it for free. I uninstalled it and switched to RustDesk, using a self-hosted server. It’s free and the frame rate and resolution are much higher than the ToDesk free version. Here is the setup record.

Basic Environment Setup

I am using two Windows computers (Win10) and one Ubuntu (configuration as shown below). Using Ubuntu as the ID/relay server, one Windows connects to the other Windows. Ubuntu needs Docker installed, and both Windows machines need RustDesk installed and configured.

Note: My three machines are on the same local network.

Hardware environment
Hardware environment

Install Docker and docker-compose-plugin

Reference:

After installation, you can add the current user to the docker user group

1234567
# Add the docker user group; it usually already exists, so no need to run thissudo groupadd docker# Add the current user to the docker user groupsudo gpasswd -a $USER docker# Update the user groupnewgrp dockerdocker version

docker-compose.yaml

Refer to the official documentation:

If ufw is enabled, you need to open these ports:

1234
sudo ufw statussudo ufw allow 21115:21119/tcpsudo ufw allow 8000/tcpsudo ufw allow 21116/udp

Choose a directory to store ID/relay server data:

123
mkdir -p ~/rustdeskcd ~/rustdesktouch docker-compose.yaml

Below is the docker-compose.yaml file from the RustDesk official documentation above:

123456789101112131415161718192021
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

Then start:

12345
docker compose up -d# Enter the ~/rustdesk/data foldercd data# View the keycat id_*.pub

RustDesk Installation and Configuration

Install by visiting the following link:

After installation, open the network settings, fill in the IP of the ID/relay server (i.e., the IP of the server running Docker) into the ID server and relay server fields. The controlled end may leave the relay server blank, but it is recommended to fill it in on the controlling end. Then fill in the key on the controlling end (the content of the .pub file in the data folder above).

Windows RustDesk Network Configuration
Windows RustDesk Network Configuration

Finally, enter the ID and password of the controlled end to connect.

Loading comments…