Getting ssh key authorisation to work in Linux
On that machine that is acting as the ssh client you should run the following command to generate a public / private key pair. It will prompt you for the location of a file to be stored the default should be acceptable unless you already have another key generated.
$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/<username>/.ssh/id_rsa): Created directory '/home/<username>/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/<username>/.ssh/id_rsa. Your public key has been saved in /home/<username>/.ssh/id_rsa.pub. The key fingerprint is: 5b:78:75:c2:58:0e:ff:89:c7:8c:0f:38:64:c0:e2:6b username@raspberrypi The key's randomart image is:
You need to keep the private key private as this is what is going to effectively be your password. It doesn't matter if somebody see's the public key. It is setup this way so you can be granted access to a machine without ever having to exchange a password over the wire. As an example you could email the public key to another admin who already has access to the machine to install the key.
On the machine that is acting as the ssh server you will need to copy the public key string that will have been generated on the client side in location "/home/
Once you add this to the file "/home/
Now that ssh works you can login to the machine by using ssh
Did You find this page useful?
Thanks for the feeback. Please consider sharing with others.