AnyDesk Unattended Access Installer for Linux Mint
A Bash script that installs AnyDesk from the official repository on Linux Mint (and other Debian/Ubuntu-based systems) and sets a password for unattended access.
What it does
- Verifies it is running as root on an apt-based system.
- Gets the unattended access password (from an environment variable or an interactive prompt).
- Adds the official AnyDesk apt repository and GPG signing key.
- Installs AnyDesk and enables its systemd service.
- Sets the unattended access password via stdin, so it never appears in the process list.
- Prints the AnyDesk ID so you can connect right away.
Requirements
- Linux Mint (tested target), or another Debian/Ubuntu-based distribution
- Root access (
sudo) - Internet access to
keys.anydesk.comanddeb.anydesk.com - An X11 desktop session (the Linux Mint default). AnyDesk does not support Wayland.
Usage
Make the script executable:
chmod +x install_anydesk_unattended.sh
Interactive
You will be prompted for the password twice (input is hidden):
sudo ./install_anydesk_unattended.sh
Non-interactive
Pass the password as an environment variable, useful for automation or deploying to multiple machines:
sudo ANYDESK_PASSWORD='your-long-password' ./install_anydesk_unattended.sh
Note that sudo VAR=value keeps the value out of the process arguments of the script, but it will still be stored in your shell history. Clear it afterwards, or read the value from a secrets manager or protected file instead:
sudo ANYDESK_PASSWORD="$(cat /root/anydesk_pw)" ./install_anydesk_unattended.sh
Output
On success the script prints something like:
AnyDesk installed and unattended access password set.
AnyDesk ID: 123456789
Use that ID and the password you set to connect from another AnyDesk client.
Password requirements
The script enforces a minimum of 10 characters. Use a long, unique password.
Security recommendations
- Use a strong, unique password. An exposed AnyDesk ID with a weak password is a common way machines are compromised.
- If your AnyDesk plan supports it, enable two-factor authentication and an access control list (allowlist of permitted AnyDesk IDs) in AnyDesk's settings.
- Avoid leaving the password in shell history, scripts under version control, or world-readable files.
- Disable or uninstall AnyDesk on machines that no longer need remote access.
Limitations
- The machine must be powered on and at the login screen or logged in. AnyDesk cannot wake a sleeping or powered-off machine (use Wake-on-LAN or similar for that).
- Wayland sessions are not supported.
- Re-running the script is safe: it reinstalls/updates the package, rewrites the repo entry, and resets the password.
Troubleshooting
| Problem | Fix |
|---|---|
Failed to set the AnyDesk password |
Make sure the service is running: sudo systemctl status anydesk. Then retry. |
| AnyDesk ID shows as unavailable | The service may still be starting. Run anydesk --get-id after a few seconds. |
| Can't connect / black screen | Check you are on an X11 session, not Wayland. At the login screen, select the Cinnamon (X11) session. |
| Repo or key download fails | Check network and proxy settings, and that keys.anydesk.com and deb.anydesk.com are reachable. |
Uninstalling
sudo systemctl disable --now anydesk
sudo apt-get remove --purge -y anydesk
sudo rm -f /etc/apt/sources.list.d/anydesk-stable.list /etc/apt/keyrings/anydesk.gpg
sudo apt-get update
Disclaimer
This script is provided as-is. AnyDesk is a trademark of AnyDesk Software GmbH; this project is not affiliated with or endorsed by AnyDesk. Only use it on systems you own or are authorized to administer.