In this section, you’ll look at controlling your Raspberry Pi using a protocol called SSH, or Secure Shell. SSH is faster and more secure, but only allows you to type commands in a terminal window; you can’t access your graphical desktop or run graphical applications using SSH.
The SSH protocol is widely used to connect to headless computers by many professional IT users who are very comfortable using a terminal, and with not having a graphical user interface such as the Raspberry Pi Desktop. SSH allows you to open a remote terminal on your Raspberry Pi and interface with it using standard terminal commands.
To SSH into your Raspberry Pi, the SSH interface will need to be enabled, just as you enabled VNC in the last section. Click on the main menu, then Preferences, and then Raspberry Pi Configuration. In the Interfaces tab, click on the radio button to enable SSH access.
As with VNC, you will need to ensure that your router’s firewall is up and running; it normally would be.
You will need to know the IP address of your Raspberry Pi to use SSH. To find this, open up a terminal and type the following:
hostname -I
The result will look something like this:
The first four numbers shown in the terminal, separated by full stops, is your Raspberry Pi’s current IP address.
Linux, macOS, and Windows
Linux, macOS, and Windows 10 have been built with SSH access ready to go. If you are using Windows 10, ensure that you have installed all the latest updates, as the SSH client was a recent addition to the operating system.
In Windows, open the PowerShell App by typing PowerShell into the Windows search box. On macOS or Linux, you need to open the Terminal app.
Now type ssh pi@<my raspberry pi ip address>. For instance, if your Raspberry Pi’s IP address was 192.168.1.206 you would enter:
ssh pi@192.168.1.206
If this is the first time you’ve connected over SSH, you will see a warning message similar to this:
The authenticity of host '192.168.1.206 (192.168.1.206)' can't be established.
ECDSA key fingerprint is SHA256:Z3qySbkZrdn1p3ptNDLBTs0xNPefIT+YGeL5SrtDTGA.
Are you sure you want to continue connecting (yes/no/[fingerprint])
Type yes and you’ll be prompted for your Raspberry Pi’s password. Unlike password fields on most operating systems, this one won’t provide any visual feedback that you are typing anything, as you won’t see anything as you type. Just type your password and press Enter.
You now have access to your Raspberry Pi, just as if you were using the terminal app in Raspberry Pi OS.
Android and iOS
Download a terminal app, such as the Termius app for Android or the Termius app for iOS. The screenshots here will show Termius for Android.
Open the app and press the plus sign to add a new connection.
Select the option to add a New Host.
On the next screen, add your Raspberry Pi’s name, its IP address, and your username (pi) and password. Click on the check mark in the top right of the screen when you are done.
3. You should now see an option to select your Raspberry Pi for a remote connection.
4. Select your Raspberry Pi and you should see a remote terminal on your Android or iOS device.
You have now seen two different methods of connecting to your headless Raspberry Pi. It is likely that you will feel most comfortable using VNC at first, but as you learn more and you become more confident with using the terminal, you might find that SSH suits you better.
When might it be useful for you to use your Raspberry Pi remotely? Would you prefer to use VNC or SSH? Share your thoughts in the comments section below.