Monthly Archives: March 2021

AnyDesk on Linux, with a twist

Situation

A remote machine is running Ubuntu Desktop. The machine is accessible via SSH. It is necessary to ensure remote desktop access using AnyDesk.

Solution, step by step

Step 1. Log into the remote system and switch to root (alternatively, do not switch to root, but use the commands below with sudo).

Step 2. Install AnyDesk. (There’s more than one way to do it; we’ll set up a repository, so AnyDesk can be updated along with the rest of the software on the machine.)

wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | apt-key add -
echo "deb http://deb.anydesk.com/ all main" > /etc/apt/sources.list.d/anydesk-stable.list
apt update
apt install anydesk

Step 3. Retrieve AnyDesk installation ID (it will be required for remote connections):

anydesk --get-id

As of this writing, the installation ID us a string of nine digits (e.g., 123456789). You will need this string to connect to the newly installed AnyDesk, so you should write it down at this stage.

Step 4.¬†Configure AnyDesk to run as a service and set up a password (let’s say, the password will be MyNewPassword) for unattended remote access:

anydesk --stop-service
echo MyNewPassword | anydesk --set-password
anydesk --service --silent

The first command stops AnyDesk service (may not be necessary, but hey, why not?). The second command sets the password by piping it to the AnyDesk utility (this is how AnyDesk recommends doing it). The third command starts the AnyDesk service in the silent mode (no pop-up messages).

Step 5. Connect to the new remote AnyDesk installation using the existing local installation.

a. Use the ID obtained in Step 3 to connect:

b. When asked, enter the password you set in Step 4:

At this stage, you should be able to see the Ubuntu desktop of the remote machine and control it the same way you would control it locally.