{ "id": "https://www.tunbury.org/2019/09/16/raspberry-pi-ssh-keys", "title": "Raspberry PI SSH Keys", "link": "https://www.tunbury.org/2019/09/16/raspberry-pi-ssh-keys/", "updated": "2019-09-16T12:41:29", "published": "2019-09-16T12:41:29", "summary": "This is my cheatsheet based upon Passwordless SSH access on the official Raspberry PI website.", "content": "

This is my cheatsheet based upon Passwordless SSH access on the official Raspberry PI website.

\n\n

On the Mac create a key (once) with a passcode

\n\n
ssh-keygen\n
\n\n

Add the key to your Mac keychain

\n\n
ssh-add -K ~/.ssh/id_rsa\n
\n\n

Optionally create a file ~/.ssh/config with these contents which contains the UseKeychain yes line which tells OSX to look at the keychain for the passphrase.

\n\n
Host *\n  UseKeychain yes\n  AddKeysToAgent yes\n  IdentityFile ~/.ssh/id_rsa\n
\n\n

Then copy your key to your Raspberry PI

\n\n
ssh-copy-id pi@192.168.1.x\n
\n\n

SSH to the PI

\n\n
ssh pi@192.168.1.x\n
\n\n

Next edit your /etc/ssh/sshd_config to turn off plain text password authentication and restart sshd.

\n\n
sudo sed -i \"s/#PasswordAuthentication yes/PasswordAuthentication no/g\" /etc/ssh/sshd_config\nsudo /etc/init.d/ssh restart\n
\n\n

Now you can SSH without a password and without getting pestered that the default password hasn’t been changed.

", "content_type": "html", "author": { "name": "Mark Elvers", "email": "mark.elvers@tunbury.org", "uri": null }, "categories": [ "raspberrypi" ], "source": "https://www.tunbury.org/atom.xml" }