Transfer public key

Time: 2 minutes

Transferring your own public key to the Pi makes it easier to log in. For example, when SSHing, you no longer have to type in your password. To do this you need to be on your own machine and open a terminal. The command below will transfer your public key to your Pi. If you don't want to or it doesn't work, it doesn't matter. You can always log in with the ubuntu:PASSWORD combination.

ssh-copy-id ubuntu@IP.ADRES.VAN.JE.PI

After confirming the public key siphoning with a password, you should now be able to log in without entering your password.

Disable password login

Only do this if you know what you are doing.

You can go a step further and only allow you to log in via the public key. Note that the USERNAME:PASSWORD combination is disabled with this.

sudo nano /etc/ssh/sshd_config

In the screen that opens, you can change the following settings:

  • #PubkeyAuthentication yes becomes PubkeyAuthentication yes.
  • #PasswordAuthentication yes becomes #PasswordAuthentication no.
  • UsePAM yes becomes UsePAM no.

Save the file with Ctrl + X and confirm with Y. After that just restart the SSH service with sudo service sshd reload and the new settings are in effect.