Selfhosting Rustdesk
Important Safety Notes
A word of Caution :
Do not blindly copy and paste these commands.
This guide is not a simple “copy/paste and hope” set of commands.
Self-Hosting RustDesk Server
- Create a VPS somewher (like Digital Ocean)
- Update:
apt update && apt dist-upgrade -y - Create a user (optional):
add testuser - harden ssh (see section below)
- Install Docker (see below)
- Deploy the RustDesk Server
RustDesk Server
Create the docker compose
I like to create it in: /opt/stacks/rustdesk/compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
networks:
rustdesk-net:
external: false
services:
hbbs:
container_name: hbbs
ports:
- 21115:21115
- 21116:21116
- 21116:21116/udp
- 21118:21118
# I like to pin the version number, instead of latest
image: rustdesk/rustdesk-server:1.1.15
command: hbbs -r rustdesk.yourdomain.com:21117 -k _
volumes:
- ./hbbs:/root
networks:
- rustdesk-net
depends_on:
- hbbr
restart: unless-stopped
hbbr:
container_name: hbbr
ports:
- 21117:21117
- 21119:21119
image: rustdesk/rustdesk-server:1.1.15
command: hbbr -k _
volumes:
## changed this after having issues with a key error
- ./hbbs:/root
networks:
- rustdesk-net
restart: unless-stopped
Spin up the server and make a note of the key:
1
docker compose up -d --force-recreate && docker compose logs -f
Make a note of the Key:
you should see it in the docker compose logs It should look somethink like this:
TcPb8aBlahBlahBlahBlahBlah=
Deploy the clients
Download them from: https://github.com/rustdesk/rustdesk/releases
That should be it, just instal the rustdesk client and change the networking information:
- Settings –> Network –> change the info in ID/Relay server
- ID server
- Key
or for Windows rename the executable to:
1
rustdesk-host=remote.yourdomain.com,key=TcBlahBlahBlah=.exe
Hardening SSH
Edit /etc/ssh/sshd_config (at the very least!):
- Disable Password-Based Authentication
PasswordAuthentication no - Deny Emtpy Passwords
PermitEmptyPasswords no - Deny Root Login
PermitRootLogin no - Limit login attempts
MaxAuthTries 5 - Additional Settings
ChallengeResponseAuthentication no KerberosAuthentication no GSSAPIAuthentication noInstall Docker
1.- Install Pre-requisites
1
apt update && apt install -y apt-transport-https curl
2.- Add Docker’s Official GPG Key and
1
`curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg`
3.- add Repo
1
2
`echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null`
4.- Update and Install Docker:
1
apt update && apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Sources
RustDesk github: https://github.com/rustdesk/rustdesk-server
Installing Docker: Source: https://linuxiac.com/how-to-install-docker-on-ubuntu-24-04-lts/