Skip to content

Instantly share code, notes, and snippets.

@rosswd
Created October 13, 2020 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosswd/f3a8dde974a84a5422c1c680d5af1f4e to your computer and use it in GitHub Desktop.
Save rosswd/f3a8dde974a84a5422c1c680d5af1f4e to your computer and use it in GitHub Desktop.
Set up ssh on a Raspberry Pi
# ssh on raspberry pi
# in these examples I use 192.168.1.10 as an example ip address for the raspberry pi
# enable ssh either using raspi-config or by placing a file named 'ssh' in the boot partition
# connect from a client
ssh pi@192.168.1.10
# set up passwordless access
##
# check for existing keys on the client ('id_rsa.pub' file)
ls -la ~/.ssh
# if no public key found
ssh-keygen
# copy key over to the raspberry pi using ssh-copy-id
ssh-copy-id pi@192.168.1.10
# test your connection
ssh pi@192.168.1.10
# connect using an alias
##
# create the config file
touch ~/.ssh/config
vim ~/.ssh/config
# example file (macos)
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Host rpi
User pi
Hostname 192.168.1.10
# connect
ssh rpi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment