Self-hosted RustDesk server

RustDesk is a great alternative to software like TeamViewer or AnyDesk, giving you the option to remote control a device.

It's also a more secure option because it's open source, end-to-end encrypted, and can be set up and self-hosted  on your VPS or Dedicated Server.

For the system to work, and you to be able to remote control a target device (host) from a source device (client) there are three components needed:

  • a RustDesk server running (with the two components: hbbs and hbbr)
  • RustDesk client running one your machine (client);
  • a target RustDesk client running on another device (host).

RustDesk server

To self-host, you will need

  • VPS or Dedicated Server;
  • Docker installed (to run the server as a container);
  • Opening specific firewall ports.

The process

  1. Open the following ports in the firewall: 21115-21117 (TCP) and 21116 (UDP). You can use firewalld, ufw, or iptables, depending on your operating system or preference.
    If you want to get the paid Pro version, and have support for web clients, there are extra ports to open: 21114 and 21119 (TCP)
  2. Install docker according to the documentation specific for your OS, available on the docker website
  3. After successfully completing the previous steps, create a directory ( something like rustdesk_server ) and in it, create a file called docker-compose.yml 

    In that file, paste this configuration:

    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



  4. Save the file and then run sudo docker compose up -d .
    To check that both containers (hbbs and hbbr) are running smoothly sudo docker compose ps.

    Upon starting the container, a /data folder is mounted, where RustDesk stores config files and the keys used for TLS encryption.

Since the host network is used directly, no further internal configuration is necessary in Docker.

Self-hosting gives you full control over the RustDesk network and prevents metadata leaks. It enables you to remotely control devices over an end-to-end encrypted connection.

 

RustDesk client(s)

Once you have the server up and running, you can install clients of all supported devices, and configure them to use your self-hosted RustDesk server, to remote control the desktops.

You can download native clients for your specific platform/OS from the official site: Download RustDesk Client

The official documentation (for each platform) is available here: RustDesk Client documentation

Once installed, you will have to configure the client(s) to use the ID/Relay server that you are hosting and in control of (see below screenshot).

 



Note that the public key is stored in the /data/  directory.

You can also find the used key by checking the logs for the hbbs server with sudo docker compose logs hbbs

 

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Setup Tor hidden service

To ensure that your website is only reachable via the Tor network and not accessible over...

Tor Exit Policy

Understanding Tor Exit Policies What is a Tor Exit Policy? Tor, an anonymity network, routes...

Setup Python App in cPanel (Webspace)

The integrated features make it simple to deploy a Python app in cPanel. Create the Python...