Setting up ssh key based authentication from a Linux machine

You have two linux machines, simon (client) and abita (server) and you want to connect from simon to abita using ssh keys. This tutorial is illustrated based on a Linux machine. Key generation method from a windows machine is slightly differet and is explained here.

Connect to simon using putty.exe. Run keygen command ssh-keygen in simon and follow the prompts. This is done to generate the keys. It is always advised NOT to set empty password.

Copy the generated key on simon to abita 's authorised_keys file. Run below from simon and follow the prompts.

Now try connecting to abita from simon use below command. When propmted for a password use the password we set when running the ssh-keygen command.

What happned here is, key generated in simon's /home/pi/.ssh/ got copied to abita's /home/pi/.ssh/authorized_keys by running ssh-copy-id pi@abita.
Now when we try to connect to abita from simon, abita check if the key from simon exists in her authorized_keys or not, if yes it allows login.
This website is hosted on a Raspberry Pi.