Previous Page

Notorious - 19 / 10 / 23

RustDesk Setup

Today we're going to install and configure RustDesk, an opensource alternative to TeamViewer that lets you connect remotely to an instance. This involves installing and configuring a RustDesk server that will act as a connection relay between our client and our local workstation.

Initial Setup

Please setup your firewall on your server prior to running the script. Make sure you have got access via ssh or otherwise setup prior setting up the firewall, command for UFW is:

ufw allow 22
ufw allow 21115:21119/tcp
ufw allow 8000/tcp
ufw allow 21116/udp
sudo ufw reload	

Please remember to forward all the following ports, respecting the protocol used from your instance to the web


Setup directory tree

sudo mkdir /opt/rustdesk 
sudo mkdir -p /var/cache/apt/archives
sudo chown -R _apt: /var/cache/apt/archives	

Server Setup

To install rustdesk, we'll use a script that will fully automate its deployment. You'll need a domain name or a static public IP address to which the rustdesk instance can be reached.

#Download the installation script

#Make it executable
chmod +x

#Run the script

When running the script, you will be asked the following questions: First, select the option corresponding to your needs, depending on whether you want to reach your instance by its domain name or by its public IP address. Secondly, choose whether you want to install the goHTTP service to provide a web server that we can join to download the installation scripts for our clients, preconfigured to match our RustDesk server configurations.

root@rrd:~# ./ 
Installing prerequisites
Get:1 bookworm-security InRelease [48.0 kB]
Hit:2 bookworm InRelease     
Get:3 bookworm-updates InRelease [52.1 kB]
Get:4 bookworm-security/main amd64 Packages [86.2 kB]
Get:5 bookworm-security/main Translation-en [48.8 kB]
Get:6 bookworm-security/contrib amd64 Packages [644 B]
Get:7 bookworm-security/contrib Translation-en [372 B]
Fetched 236 kB in 2s (120 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
wget is already the newest version (1.21.3-1+b2).
tar is already the newest version (1.34+dfsg-1.2).
The following additional packages will be installed:
Suggested packages:
The following NEW packages will be installed:
  curl dnsutils libcurl4 unzip
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1130 kB of archives.
After this operation, 2021 kB of additional disk space will be used.
Get:1 bookworm/main amd64 dnsutils all 1:9.18.19-1~deb12u1 [259 kB]
Get:2 bookworm-security/main amd64 libcurl4 amd64 7.88.1-10+deb12u4 [390 kB]
Get:3 bookworm-security/main amd64 curl amd64 7.88.1-10+deb12u4 [315 kB]
Get:4 bookworm/main amd64 unzip amd64 6.0-28 [166 kB]
Fetched 1130 kB in 0s (13.8 MB/s)                        
Selecting previously unselected package libcurl4:amd64.
(Reading database ... 21375 files and directories currently installed.)
Preparing to unpack .../libcurl4_7.88.1-10+deb12u4_amd64.deb ...
Unpacking libcurl4:amd64 (7.88.1-10+deb12u4) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.88.1-10+deb12u4_amd64.deb ...
Unpacking curl (7.88.1-10+deb12u4) ...
Selecting previously unselected package dnsutils.
Preparing to unpack .../dnsutils_1%3a9.18.19-1~deb12u1_all.deb ...
Unpacking dnsutils (1:9.18.19-1~deb12u1) ...
Selecting previously unselected package unzip.
Preparing to unpack .../unzip_6.0-28_amd64.deb ...
Unpacking unzip (6.0-28) ...
Setting up unzip (6.0-28) ...
Setting up dnsutils (1:9.18.19-1~deb12u1) ...
Setting up libcurl4:amd64 (7.88.1-10+deb12u4) ...
Setting up curl (7.88.1-10+deb12u4) ...
Processing triggers for libc-bin (2.36-9+deb12u3) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for mailcap (3.70+nmu1) ...
1) IP
2) DNS/Domain
Choose your preferred option, IP or DNS/Domain:2
Enter your preferred domain/dns address :
Creating /opt/rustdesk
Installing Rustdesk Server
--2023-10-19 12:32:34--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]
--2023-10-19 12:32:34--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8528063 (8.1M) [application/octet-stream]
Saving to: ''

rustdesk-server-linux-amd64.z 100%[=================================================>]   8.13M  18.6MB/s    in 0.4s    

2023-10-19 12:32:34 (18.6 MB/s) - '' saved [8528063/8528063]

  inflating: amd64/hbbr              
  inflating: amd64/hbbs              
  inflating: amd64/rustdesk-utils    
Creating /var/log/rustdesk
Created symlink /etc/systemd/system/ -> /etc/systemd/system/rustdesksignal.service.
Created symlink /etc/systemd/system/ -> /etc/systemd/system/rustdeskrelay.service.
Rustdesk Relay not ready yet...
Tidying up install
1) Yes
2) No
Please choose if you want to download configs and install HTTP server:1
--2023-10-19 12:32:45--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3337 (3.3K) [text/plain]
Saving to: 'WindowsAgentAIOInstall.ps1'

WindowsAgentAIOInstall.ps1    100%[=================================================>]   3.26K  --.-KB/s    in 0s      

2023-10-19 12:32:45 (47.0 MB/s) - 'WindowsAgentAIOInstall.ps1' saved [3337/3337]

--2023-10-19 12:32:45--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4682 (4.6K) [text/plain]
Saving to: ''         100%[=================================================>]   4.57K  --.-KB/s    in 0s      

2023-10-19 12:32:45 (53.3 MB/s) - '' saved [4682/4682]

Creating /opt/gohttp
Installing Go HTTP Server
--2023-10-19 12:32:46--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]
--2023-10-19 12:32:46--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4864160 (4.6M) [application/octet-stream]
Saving to: 'gohttpserver_1.1.4_linux_amd64.tar.gz'

gohttpserver_1.1.4_linux_amd6 100%[=================================================>]   4.64M  20.2MB/s    in 0.2s    

2023-10-19 12:32:46 (20.2 MB/s) - 'gohttpserver_1.1.4_linux_amd64.tar.gz' saved [4864160/4864160]

Creating /var/log/gohttp
Tidying up Go HTTP Server Install
Created symlink /etc/systemd/system/ -> /etc/systemd/system/gohttpserver.service.
Your IP/DNS Address is
Your public key is mypubkey
Install Rustdesk on your machines and change your public key and IP/DNS name to the above
You can access your install scripts for clients by going to
Username is admin and password is myPasswd

If you "lose" the public key given at the end of script execution, you will be able to find it in the tree below

root@rrd:/opt/rustdesk# ls -la
total 27692
drwxr-xr-x 2 root root     4096 Oct 19 08:37 .
drwxr-xr-x 4 root root     4096 Oct 19 08:37 ..
-rw-r--r-- 1 root root     4096 Oct 19 08:37 db_v2.sqlite3
-rw-r--r-- 1 root root    32768 Oct 19 08:52 db_v2.sqlite3-shm
-rw-r--r-- 1 root root    70072 Oct 19 08:52 db_v2.sqlite3-wal
-rwxr-xr-x 1 root root  9171176 Jul 25 07:48 hbbr
-rwxr-xr-x 1 root root 14314024 Jul 25 07:48 hbbs
-rw-r--r-- 1 root root       88 Oct 19 08:37 id_ed25519
-rw-r--r-- 1 root root       44 Oct 19 08:37  <-- cat this 
-rwxr-xr-x 1 root root  4734912 Jul 25 07:48 rustdesk-utils

Manual Client configuration

Click on the 3 dots to go in the rustdesk client settings

After that you can go to the network section, and put your rustdesk domain in the ID server and Relay Server section. Put the previous public key in the key section and the url of your api in the API server box.

Once you have configured your client to use your rustDesk server by filling in the various information, click on apply to save the configuration and test the connection on your client.

Once the client has been configured, simply enter its id to see it appear on the rust desk interface, then double-click on it to launch the connection to the client.

Enter your password

Well done, we are now connected to our remote host through our RustDesk instance.

Auto deploy client with generated scripts

If you choose to setup an HTTP server during the installation, you can join it in your web browser to get an automatic client already configured to match your RustDesk server settings.

After dl the scripts juste make it executables and run it on your client Careful the initial setup set a basic auth password for access to the gui. If you loose or you want to change them you can recover or modify it in the rustdesk service file

#Edit the service file
vim /etc/systemd/system/gohttpserver.service	

Here you can see your Basic Auth credentials

Description=Go HTTP Server
ExecStart=/opt/gohttp/gohttpserver -r ./public --port 8000 --auth-type http --auth-http admin:myPasswd
# Restart service after 10 seconds if node service crashes

Upgrade your Server

Run the following commands:

#Download update script

#Make it executables
chmod +x

#Run it


Death Is Near

About Notorious

Donate XMR:498pGjtN5jKGG4QJ7ubS5rVdsWEgovzgM6cCQpFwhXiPSq39q1izZE7UFTfxinyrZud2PpLRMiU6DJUnCEsR3iPGHqswj9U