Skip to main content

SSH connections,... and forget about passwords!

Jose CerrejonLess than 1 minuteAppleLinuxRaspberry PIBanana PiAppleLinuxRaspberry PIBanana Pi

SSH connections,... and forget about passwords!

SSH hodor
SSH hodor

This guide is essential to our daily with SSH connections, but sometimes we become lazy (I'm the first).

I explain VERY EASILY how to generate keys you need so you don't have to write the damn password in each SSH connection.


Let's create the public/private keys and copy the first on the remote computer. Wrote the following from the computer where we are going to connect (in my case, a Mac):

cd .ssh
ssh-keygen -b 1024 -t rsa -f id_rsa -P ""
ssh pi@192.168.1.4 < ~/.ssh/id_rsa.pub 'mkdir -p .ssh && cat >> .ssh/authorized_keys'
OSX Terminal showing all the process
OSX Terminal showing all the process

With the last command, we copy from our Linux/OSX the public key to the remote device. In this example, 192.168.1.4 (my Raspberry Pi).

END

It was not so hard, right?. Why have you don't this before?.

If you want to type less, create an alias in your Linux/OSX: nano ~/.bash_profile

Example: alias sshrpi='ssh pi@192.168.1.4'

And reload the shell with: source ~/.bash_profile

Now, every time you type sshrpi, will access from your computer to the Pi with no password.

Welcome.

smile
smile

Link: raspberrypi.org > Passwordless SSH accessopen in new window