Skip to content

Latest commit

 

History

History
105 lines (77 loc) · 2.3 KB

03-configure-passwordless-ssh.md

File metadata and controls

105 lines (77 loc) · 2.3 KB

Configure Passwordless SSH

How to connect to Raspberry Pi 3 Model B+ without password

Prerequisite(s):

Note: We are using word USER-NAME in following commands please change it with your operating system's user name


1 - Check for existing SSH keys


On Linux & Mac OS
$ ls ~/.ssh
On Windows OS
C:\Users\USER-NAME\.ssh> dir

Note: If you see files named id_rsa.pub or id_dsa.pub you have keys set up already, so you can skip the generating keys step (or delete these files with rm id* or del id* and make new keys).


2(a) - Use existing SSH Key (recommended if SSH key exist)


To use existing pub key open id_rsa.pub or id_dsa.pub in editor and copy its contents.

On Linux & Mac OS
$ nano ~/.ssh/id_rsa.pub
On Windows OS
C:\> Notepad "C:\Users\USER-NAME\.ssh\id_rsa.pub"

Ctrl + A -> Ctrl + C


2(b) - Generate New SSH Key


On Linux & Mac OS
$ ssh-keygen

Note: Upon entering this command, you'll be asked where to save the key. We suggest you save it in the default location /home/USER-NAME/.ssh/id_rsa by just hitting Enter.

On Windows OS
C:\> ssh-keygen

Note: Upon entering this command, you'll be asked where to save the key. We suggest you save it in the default location C:\Users\USER-NAME\.ssh\id_rsa by just hitting Enter.


3 - Copy your public key to your Raspberry Pi


On Linux & Mac OS
$ cat ~/.ssh/id_rsa.pub | ssh [email protected] 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'

Connect to Raspberry Pi using SSH without password

On Windows OS
C:\> Notepad "C:\Users\USER-NAME\.ssh\id_rsa.pub"

Select All and Copy: Ctrl + A -> Ctrl + C

pi@raspberry:~ $ mkdir .ssh
pi@raspberry:~ $ cd .ssh/
pi@raspberry:~ $ echo [PASTE-KEY-CONTENTS-HERE] >> authorized_keys
pi@raspberry:~ $ exit

Close Terminal and Open Again to connect to Raspberry Pi using SSH without password