====== Auto Configure Clients ======
You can set up a repository to automate installation on your client machines.
These scripts
- Download and install the current version of RustDesk Client
- Set the ID Server, Relay Server, API Server and key
- Create a static password
===== Determine your configuration string =====
Choose one of the following two options, and save the result someplace.
==== Client already configured ====
If you already have a client connected, you can get the configuration string through it
- Click the three dots next to your ID
- Select Network fro the menu on the left
- Select Unlock network settings
- Click ID/Relay Server
- Click the copy icon (two pieces of paper, upper right)
Your configuration is now stored in your clipboard. Save that someplace.
==== Manually create from command line ====
You will need two pieces of information; the contents of /opt/rustdesk/id_ed25519.pub and your DNS Hostname or IP Address.
In this example, I'm going to use the hostname of **rustdesk.example.org**, and the contents of the public key as **wMloYQ1ITxrK/IMDcusccQZC0isjybRA16r9bSDhvqk=**. Change that for your machine
echo '{"host":"rustdesk.example.org","key":"wMloYQ1ITxrK/IMDcusccQZC0isjybRA16r9bSDhvqk="}' | base64 -w 0 | tr -d '=' | rev
This returns the following string
gC9JSPrFndoR0Uiljc2ETQSJWeqNXawMkWRN2YzV3YE1USvskc4RVSxEVWvxWT3JiOikXZrJCLicmcv5SZsBXbhhXZus2clRGdzVnciojI0N3boJye
Store it someplace; you'll need it to customize your installers
===== Download installer scripts =====
Several installer scripts are available from [[https://rustdesk.com/docs/en/self-host/client-deployment/|RustDesk]]. These include:
* PowerShell script for Microsoft Windows
* Batch/cmd script for Microsoft Windows (use the PowerShell)
* Bash script for MacOS
* Bash script for Linux
* Note that this only works on systems which use SystemD as the init, but will give an error message if the distribution is unsupported
Download the installers you want to use.
===== Customize Scripts =====
Edit each installer script. In the script, you will find the string **configstring**, probably in single or double quotes. Replace **configstring** with what you received in the first step (your configuration string)
These installers can be run on workstations which will automatically download and install RustDesk Client and do the base configuration.
===== Single script =====
If you are on a Unix machine (includes MacOS), all of the steps can be done at one time. Download all of your installer scripts into one directory. Save them all with either a .sh or a .ps1 suffix (bash shell and powershell respectively), then run the command below in that directory.
If you already have your configuration string, create a file named configstr.txt and put it in there, with **no line returns**. No blank lines before, after, etc...
WARNING: All .sh and .ps1 files in the directory will be modified with no backup.
#! /usr/bin/env bash
if [ ! -f configstring.txt ]
then
echo -n '{"host":"rustdesk.example.org","key":"wMloYQ1ITxrK/IMDcusccQZC0isjybRA16r9bSDhvqk="}' | base64 -w 0 | tr -d '=' | rev > configstring.txt
fi
config=`cat configstring.txt`
for file in `ls *.ps1 *.sh`
do
sed -i "s|configstring|$config|g" $file
done
This will also put the configuration string into the file configstring.txt. If you can not use an installer, just open that file and copy that in the clipboard and import it into your client (same as exporting above, just using the other icon)