diff --git a/01 Getting Started.md b/01 Getting Started.md index 0434d24..19c8ed1 100644 --- a/01 Getting Started.md +++ b/01 Getting Started.md @@ -131,3 +131,34 @@ pi@doej:~ $ If you are using Windows 10 you will need to download the [Putty](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) application. After launch you need to enter the hostname and user credentials in the appropriate boxes. Once logged in, Putty behaves like a standard terminal window. If the credentials are correct you are now connected to the server and all the commands you enter will be run on it. To quit and return to your computer enter the `exit` command. + +## 5 SSH Login Without Password + +Now we have enabled remote login we will finish by setting up ssh access that won't prompt you for your password! To do this you will need to complete the following steps (Only tested on MacOS and Ubuntu): + +The first step is to check your local computer (the one you will be connecting from) to see if you have a pair of authentication keys. These will be in a hidden directory called `.ssh` located in your home directory. + +```shell +$ test -f ~/.ssh/id_rsa ; echo $? + 0 +``` + +A non-zero value indicates an error so, if the command returns `1` you will need to generate the keys: + +``` + ssh-keygen -t rsa +``` + +Accept all the default options (keep pressing the enter key). + +Now copy the contents of the `id_rsa.pub` file to the clipboard. On MacOS you can use the command `pbcopy ~/.ssh/id_rsa.pub`. On linux display the contents of the file using `less ~/.ssh/id_rsa.pub` then select and copy. + +Now log into the Raspberry Pi and create a file called `authorized_keys`: + +```shell +nano ~/.ssh/authorized_keys +``` + +In the nano editor paste in the public key from your local computer then save (`ctrl+O`) and quit (`ctrl+X`). + +If you log back out the raspberry pi then try logging in again you will not be prompted for the password!