How to Connect to a Raspberry Pi Remotely Using SSH
Having to connect a monitor, keyboard and mouse up to your Raspberry Pi every time you want to use it can be a real pain! Why not connect to and use your Pi remotely? One way of doing this is via SSH (Secure Shell), it's a cryptographic network protocol for operating network devices securely. It's really handy for when you've got a Pi setup doing a task or in a case and you only need access to the terminal functionality on the Pi. Follow these steps and you'll be all set up and ready to connect to your Pi using SSH in no time!
1) Enable SSH
First, you need to enable SSH functionality on the Raspberry Pi in order to be able to connect to it using this method. It is enabled in the Raspberry Pi configuration settings, this can be found by entering "sudo raspi-config" into the terminal. Select Interfacing Options and then SSH, click enter when this is highlighted and select Enable. You will then need to navigate to the Finish option to exit the options menu.
2) Find the IP address
In order to connect to the Raspberry Pi via the local network, you'll need to know the devices IP address. This can be found by looking at the devices networking information using the "ifconfig" command.
If you're connected to the internet via WiFi then you'll need the IP address in the wlan0 section and if you're using an ethernet cable then you'll need the one displayed in the eth0 section. The local IP address should look something similar to this 192.168.X.XX. Make a note of this number as we'll need it in the next step.
3) Connect to the Pi using SSH
There is a range of different programs you can use to connect to the Pi via SSH. If you're on Windows we'd suggest using PuTTy and if you're on a MacOS device we'd suggest using the built-in Terminal.
Open up PuTTy, the default screen should be for starting a new connection. All you have to do is enter the IP address for the Raspberry Pi that we found in the previous step and enter the Port number as 22. Then hit open and a terminal window should pop up prompting you to enter the devices username and password, if you've not changed these then the default if username: pi, password: raspberry.
For MacOS Terminal:
Open a terminal window, this can be done using the spotlight search (cmd +space). Then enter "ssh email@example.com.X.XX" using the IP address found earlier, once entered you'll be prompted to enter the Raspberry Pi's password. If entered correctly you'll be greeted with the usual command line.