SSH + Raspberry Pi

InfectiousGrin
Nov 20, 2013 · 2 min read

This is part of a short series of posts that i'm writing shortly after getting my hands on a Raspberry Pi In which i want to;

Setting up your SSH keys

You can skip this section; Assuming you already have set up your SSH keys, in order to use something like Heroku or GitHub.If you haven't here’s a good article from GitHub.

Get your SSH key to the Pi

After setting you your SSH key (above) you should find that you have the following two files; ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub

These represent your public and private keys. We want to copy our public key (id_rsa.pub) in to a file called “authorized_keys” on the Raspberry Pi.

First, use secure copy or SCP to copy the file over.

$ scp ~/.ssh/id_rsa.pub pi@<ip address>:key.pub

Then, SSH into your Raspberry Pi.

$ ssh pi@<ip address>

If you don't have an .ssh directory (ls -a) then create it.

$ mkdir ~/.ssh

Append your public key to the file called “authorized_keys”.

$ cat key.pub >> .ssh/authorized_keys

Ensure that the owner can has read and write permissions.

$ chmod 600 .ssh/authorized_keys

And remove public key file that you initially copied over.

$ rm key.pub

Now you should be able to exit you ssh session and the next time you start it up, you wont have to enter your password.

    InfectiousGrin

    Written by

    http://infectiousgr.in

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade