Update on April 15, 2023

SSH Keys

SSH keys are a more secure way of logging into a server than pass words.

Generating Private & Public Keys

To generate SSH keys:

ssh-keygen

The command will generate both a private key, id_rsa, and a public key, id_rsa_pub. It will prompt you for where to store the keys. The default location is:
 
~/.ssh

It will also prompt you for a paraphrase to be used as a password. For no password, leave blank.

Transferring the Public Key to a Sever

To transfer the public key to a server:

ssh-copy-id pi@192.168.0.x

It will prompt you for your password for the last time. In the future, it will use your public key for authentication.

It stores the public key on the server in the file:
 
~/.ssh/authorized_keys

Disabling SSH Password Authentication

Once SSH keys are setup and working, you can make your password a lot longer, or you can disable SSH password authentication.

To disable SSH password authentication for a particular user, add the following to:
 
/etc/ssh/sshd_config

Match User user_name
  PasswordAuthentication no

Without the "Match" line, this will deny all users from logging in via a password.

References:

  1. YouTube/SpaceRex - SH into your Pi WITHOUT a Password with SSH Keys!
  2. SpaccRex - Raspberry Pi and Synology NAS Tutorials
  3. SSH Keys With Synology NAS: Setup Tutorial