- Enable SSH on your Raspberry Pi 3 Model B+
- Understand how to connect to your Raspberry Pi 3 Model B+ using SSH
Note: We are using word
USER-NAME
in following commands please change it with your operating system's user name
$ ls ~/.ssh
C:\Users\USER-NAME\.ssh> dir
Note: If you see files named
id_rsa.pub
orid_dsa.pub
you have keys set up already, so you can skip the generating keys step (or delete these files with rmid*
ordel id*
and make new keys).
To use existing pub key open id_rsa.pub or id_dsa.pub in editor and copy its contents.
$ nano ~/.ssh/id_rsa.pub
C:\> Notepad "C:\Users\USER-NAME\.ssh\id_rsa.pub"
Ctrl + A
-> Ctrl + 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
/home/USER-NAME/.ssh/id_rsa
by just hitting Enter.
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.
$ cat ~/.ssh/id_rsa.pub | ssh [email protected] 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'
Connect to Raspberry Pi using SSH without password
$ ssh [email protected]
C:\> Notepad "C:\Users\USER-NAME\.ssh\id_rsa.pub"
Select All and Copy: Ctrl + A
-> Ctrl + C
C:\> ssh [email protected]
[email protected]'s password:
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
C:\> ssh [email protected]