RustDesk is an open-source remote desktop solution that gives you full control of your remote connections through a self-hosted private server. It's an alternative to closed-source applications such as TeamViewer and AnyDesk with a lightweight, privacy-centric interface.
This guide describes how you can install the RustDesk remote desktop server on Ubuntu, and connect remote devices using a RustDesk client application.
Before your begin, make sure you:
RustDesk is lightweight, and you can install it on an existing Ubuntu server running docker.
A subdomain masks your direct public server IP Address protecting it from potential attacks.
Create a new directory to store RustDesk docker files.
$ sudo mkdir -p /opt/rustdesk
Switch to the directory.
$ cd sudo /opt/rustdesk
Create a new rustdesk.yml
file.
$ sudo touch rustdesk.yml
Edit the file using a text editor like Nano
.
$ sudo nano rustdesk.yml
Add the following configurations to the file.
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
command: hbbs -r 127.0.0.1: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:latest
command: hbbr -k _
volumes:
- ./hbbr:/root
networks:
- rustdesk-net
restart: unless-stopped
Save and close the file.
Start the RustDesk server containers.
$ sudo docker-compose -f rustdesk.yml up -d
Verify that RustDesk hbbs
, hbbr
containers are up and running.
$ sudo docker ps
While using RustDesk directly in a local development environment is safe, this would expose your backend port in production. To safely use RustDesk, set up Nginx as a reverse proxy to serve requests through a subdomain to the backend hbbs
and hbbr
ports.
First, allow Nginx to communicate on HTTP 80
through the default firewall (UFW).
$ sudo ufw allow 80/tcp
Reload Firewall rules.
$ sudo ufw reload
Create a new Nginx configuration file.
$ sudo touch /etc/nginx/conf.d/rustdesk.example.conf
Edit the file.
$ sudo nano /etc/nginx/conf.d/rustdesk.example.conf
Add the following configuration to the file.
server {
listen 80;
listen [::]:80;
# Set your subdomain
server_name rustdesk.example.com;
# Proxy Requests to the RustDesk host port
location / {
proxy_pass http://127.0.0.1:21117;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Save and close the file.
Test the Nginx configuration for errors.
$ sudo nginx -t
Restart Nginx.
$ sudo systemctl restart nginx
Based on your Docker compose configuration, the RustDesk server encrypts all connections based on your public key available in the hbbs
directory. Any RustDesk client without the key cannot connect through the relay server.
View and copy your server public key.
$ cat /opt/rustdesk/hbbs/id_ed25519.pub
Your Output should look like the one below.
WfgvfV002mcFRevj205Fd+3vEEEWpeHlcL3xAXnAxJ4=
Click OK to save changes and establish a connection to your RustDesk server.
Copy the remote computer ID and password, or click Settings, navigate to Change ID and set it to your preferred value.
You have successfully installed RustDesk server on Ubuntu and established a connection to a remote machine. The client application is available for Windows, Linux, macOS, Android, and iOS devices. For more information, please visit the official RustDesk documentation.