SSH also referred to as Secure Shell, is an encoded networking technology that allows you to manage computers over a command-line network.
Therefore, you can use this technology to access the command line of your Raspberry Pi remotely. This consequently converts your Raspberry Pi to function as a remote gadget, meaning you can use a client to connect to it from a different machine.
Using SSH, you can successfully complete lightweight distro installations that lack graphical interfaces and projects that lack a screen. It also allows you to connect your Raspberry Pi from the terminal window on a different computer. Therefore, it’s clear that SSH is very useful, so here’s an overview of the steps to SSH into the Raspberry Pi.
Steps on How to SSH into a Raspberry Pi
Step 1: Enable SSH on The Raspberry Pi
If you’re using a Raspbian version designed from late 2016 forwards, then you know that SSH, by default, is disabled. This was done to better the security from what it previously was where Raspbian images had a user “pi” with the default password set being “raspberry.” Due to this simplicity, it became very easy to manipulate things in their favor.
The methods you can use to enable SSH include:
Using the GUI
If you’ve connected a monitor and peripherals to your Raspberry Pi, it’s a lot easier and quicker to enable SSH. The steps you need to follow when doing this are:
- Head to the top-left corner and click on the raspberry logo, choose Preferences > Raspberry Pi Configuration
- In the configuration window, head to the Interfaces tab
- Go to the second line and Enable SSH
- Click OK and save these settings
Using Terminal
You should do this by opening Terminal and entering the command:
sudo raspi-config
After doing this, go to the Advanced Options and then choose SSH. A question will pop up on whether to enable the SSH server, and you should click “Yes.”
Headless Mode
When using a Raspberry Pi without a keyboard and monitor, the one way of enabling SSH on this headless mode is by using a blank boot file.
While doing this, you’ll have to create an empty SSH file on a different machine. You should then use this file to enable SSH on the Raspbian boot SD card. If you aren’t in the mood of making this file by yourself, you can download an SSH boot file.
The steps you should follow when enabling SSH on your Raspberry Pi are:
- Ensure the Raspbian on the Raspberry Pi microSD card is installed properly. After doing this, switch off this gadget and then take out the card.
- Insert the microSD into your computer’s card reader.
- Navigate the boot folder, which is your SD card’s root folder.
- Create a file that doesn’t have an extension and name it ssh.
- Eject the microSD card from your computer and put it inside your Raspberry Pi.
- Boot up your Raspberry Pi
Step 2: Find The Raspberry Pi’s IP Address
You’ll need to know the IP address of your Raspberry Pi when connecting it. When connecting the Raspberry Pi from the inside of your home computer, you should open Terminal and then enter the command;
hostname –I
When looking to connect your Raspberry Pi while outside your home network, it’ll be necessary to put port forwarding and establish the public IP address. Finding the public address is straightforward and shouldn’t take you much time.
All you need to do is use a search engine and then key in “what is my IP address.” Consequently, press enter, and the search engine, whether it’s DuckDuckGo or any of your preferred picks, will find an answer. The format of this IP address will be ####. ####. ####. #### with # symbolizing a digit.
You’ll need to remember these digits regardless of whether you pick a public IP address or a private IP address.
Step 3: SSH into The Raspberry Pi
Windows
You’re required to use a program known as PuTTY when connecting your Raspberry Pi with SSH. Therefore, download the putty.exe file and then click Run. Consequently, the PuTTY Configuration window will pop up, showing basic options.
You should follow this up by entering your Raspberry Pi’s IP address in the field “Host Name” and never alter the field labeled “Port.” After this, Click Open, and the PuTTY “Security Alert” field pops up, and you should click Yes. You’ll see the terminal window displaying “login.as.” After this, enter pi and then press RETURN and enter your Raspberry Pi’s password.
Once you do this, you’ll be connected to your Raspberry Pi, and using Linux commands, you’ll be able to control a gadget remotely.
Mac OS X
The steps to follow when connecting the Raspberry Pi on the Mac OS X is simple because this operating system is installed with a Terminal. All that’s required from you is to open Terminal and then put this command:
ssh pi@###. ####. ####. ####
Subsequently, a security alert will pop up, and you should type “Yes” to proceed.
You should then log in to the Raspberry Pi and if the defaults haven’t been changed, type in the username “pi” and “raspberry” for the password.
Once you do this, you’re now connected to the Raspberry Pi and can use Linux commands to control it.
Troubleshooting Ideas
If you’re experiencing any trouble creating an SSH connection to your Raspberry Pi, there are several things you can do. This includes:
- Make sure you’ve used accurate credentials
- Ensure you’re using an accurate IP address
- Confirm SSH on your Raspberry Pi has been enabled
- When connecting using a public network, ensure to set up port forwarding
Conclusion
Reading through this comprehensive article has offered you the needed guidance if you wanted to learn how to SSH into your Raspberry Pi. Therefore, you can now go ahead and enable this service even when you don’t have a keyboard or monitor connected to the Raspberry Pi. You also have learned of the steps to take when there are peripherals, with the ideal choice down to your personal preference.