Just to add some more precisions on what you provided, the public key that you want to whitelist must be placed in the file authorized_keys
in the folder mentioned by @cariboo
Also, you should check the config file for SSH in order to use only those keys and refuse connections through password authentication. This is done in the file placed in /etc/ssh/sshd_config
:
- Set
PubkeyAuthentication
toyes
- Set
PasswordAuthentication
tono
This way you will be able to connect to your Pi with your SSH key. To set this up, you will have to copy your public key onto your pi (scp pi@local_ip path/to/public_key
) using your password and copy the content of your public in authorized_keys
. Once you edited the configuration of SSH, you will have to run sudo service ssh restart
to make it take effect.
Hope this helps