1.- Generate a SSH key in your local machine.

2.- Copy the public key to the remote machine.

ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote_machine

3.- Disable password authentication in the remote machine.

Open the configuration file:

sudo vim /etc/ssh/sshd_config

Change the PasswordAuthentication value to no:

PasswordAuthentication no

NOTE: Check if any any configuration file under /etc/ssh/sshd_config.d/ is overriding the PasswordAuthentication value.

4.- Restart the SSH service.

sudo systemctl restart sshd

👉 More info

Add a new authorized key

To add a new authorized key use any computer with access and paste the new key in the ~/.ssh/authorized_keys file in the remote machine.

Add the host to the SSH client config

Edit the file ~/.ssh/config and add the following:

Host ionos
	HostName 123.123.123.123
	User admin