In this tutorial, I will show how can you enable SSH on Raspberry Pi OS. SSH aims to facilitate the access of your system command line from another computer. In my case, I use a MacBook, and I configure my Raspberry Pi without need any device plugged on it, only the power adapter.
On the Rapberry Pi OS, press Ctrl+Alt+T to open the terminal and type the commands bellow:
sudo systemctl enable ssh sudo systemctl start ssh
The first command you enable the SSH service and the second command will start SSH
Access Raspberry Pi OS from another computer using SSH
Using Linux, Mac and Windows 10 (most current versions) you use the terminal or prompt (Windows) to use SSH. Just type the command
ssh [email protected] type your password as requested and done!
192.168.15.26 is my Raspberry Pi IP Address. You can find you IP, just typing
hostname -I in the Raspberry Pi OS terminal.
On old versions of Windows, you will need to use PuTTY SSH client. You can check here how you can install and use it
Configuring SSH public/private key on your computer
If you want to access the Raspberry Pi using SSH, but don’t wanna type the password giving up security, you can use SSH public/private key to access like the image bellow:
To generate the private/public key:
- run the command
- Enter a passphrase if you want. If not, just press enter
- Confirm your passphrase, or just press enter for no password
Configure public key on your Raspberry Pi OS
- Run the command
cat ~/.ssh/id_rsa.pubto get the public key
- Copy the key exposed by the command
- Enter on Raspberry Pi OS using the command
- Run the command mkdir
~/.ssh && touch ~/.ssh/authorized_keysto create .ssh folder and the authorized_keys file
- Run the command nano
~/.ssh/authorized_keysto edit the file
- Paste the public key exposed on step 2
- Press Ctrl+X and Enter to write
- Press Y to confirm the write on the file and run the command
exitto close the SSH connection with Raspberry Pi OS
- Now you can connect into your Raspberry Pi OS without type any password using the same command
That’s it for now! I’m very happy to help you to configure Raspberry Pi OS SSH. Bye!