Mark Ku's Blog

Introduction

You've probably all heard of or used the well-known remote desktop tool, TeamViewer. But when it started charging, we began a constant search for free alternatives. I've tried options like AnyDesk and AweSun, but they often suffered from unexplained lag or disconnections. Finally, I found RustDesk—an open-source, free, and easy-to-use remote connection tool that we can self-host with Docker.

Advantages of RustDesk

  • Efficient and Secure: RustDesk is written in Rust, a highly efficient and secure programming language.
  • Multi-Platform Support: It works seamlessly on Windows, Linux, macOS, and even iOS and Android.
  • Simple and Easy to Use: The user experience is as intuitive as TeamViewer, and it uses NAT traversal to ensure stable connections.
  • Private and Flexible: RustDesk allows you to host your own relay server, giving you greater control over your privacy.
  • Stable Connections: RustDesk maintains a stable connection even on unreliable networks.
  • Open and Free: You can use RustDesk completely for free, and its open-source code allows you to inspect or modify it at any time. Come and experience your very own RustDesk remote desktop tool!

Prerequisites

  • An Ubuntu server to install the RustDesk Server on.
  • A dedicated IP address configured for your Ubuntu server.
  • Docker installed on the Ubuntu server.

First, Install the RustDesk Server

On your Ubuntu server with Docker installed, create a docker-compose.yaml file.

vim docker-compose.yml

version: '3'

networks:

  rustdesk-net:

    external: false

services:

  hbbs:

    container_name: hbbs

    ports:

      - 21115:21115

      - 21116:21116

      - 21116:21116/udp

      - 21118:21118

    image: rustdesk/rustdesk-server:latest

    # yourIP 換成你的外部網路 IP 

    command: hbbs -r {yourIP}:21117

    volumes:

      - ./data:/root

    networks:

      - rustdesk-net

    depends_on:

      - hbbr

    restart: unless-stopped



  hbbr:

    container_name: hbbr

    ports:

      - 21117:21117

      - 21119:21119

    image: rustdesk/rustdesk-server:latest

    command: hbbr

    volumes:

      - ./data:/root

    networks:

      - rustdesk-net

    restart: unless-stopped

Start the Service

sudo docker compose up -d

Disable the Firewall

sudo ufw allow 21115:21119/tcp
sudo ufw allow 8000/tcp
sudo ufw allow 21116/udp
sudo ufw enable

Test (PowerShell)

test-netconnection domain.com -p 21115
docker logs containerID

Configure the Client

First, download and install the RustDesk client.

Next, let's set a permanent password for this client. Go to Settings > Unlock Security Settings > Set permanent password.

RustDesk security settings with permanent password option highlighted
RustDesk security settings with permanent password option highlighted

Then, configure it to use the RustDesk Server you set up earlier. Unlock Network Settings > Relay Server > {YourPublicIP}:21116

P.S. The latest versions now require you to enter a key, so you'll need to enter the hbbs container to find out what the key is. RustDesk network settings showing relay server IP and key

Check the status bar at the bottom. If it shows 'Ready', the connection is successful.

RustDesk application showing Ready status and remote desktop interface
RustDesk application showing Ready status and remote desktop interface

Connection Screen

RustDesk password prompt for remote desktop connection
RustDesk password prompt for remote desktop connection

In Use - Desktop Version

Desktop screenshot with futuristic gun wallpaper and application icons
Desktop screenshot with futuristic gun wallpaper and application icons

In Use - Mobile Version

Windows desktop with RustDesk icon and remote access controls
Windows desktop with RustDesk icon and remote access controls

Enable/Disable Wayland on Ubuntu 20.04 Desktop

Author

Mark Ku

擁有 10+ 年經驗的資深軟體工程師,現為 AI 應用 Builder,專注於大型平台架構與簡化複雜系統設計,從電商系統到訂閱與收費平台,結合 AI Agent、AI 整合與自動化開發,打造高效率且可持續演進的產品技術基礎。Read More

Found this useful?

The author's free tools, daily podcasts and newsletter are all here.

Mark Ku · This article is licensed under CC BY 4.0. Credit the author and link back to the original when reusing it.

Comments

Subscribe to Newsletter

Subscribe to get new posts delivered instantly — never miss a tech share.

By submitting, you agree to receive emails. You can anytime.

Popular Posts

View all
Mark Ku
··602

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution
Mark Ku
··490

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.
Mark Ku
··333

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki
Mark Ku
··264

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning
Mark Ku
··221

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1
Mark Ku
··215

Setting Up Samba on Ubuntu to Share Folders with Windows 11

Setting Up Samba on Ubuntu to Share Folders with Windows 11