December 1, 2022

SwissQuantumPi: Configuring SSH

To remotely access to your Raspberry Pi, you need to enable SSH first.

Follow the steps below to learn how to enable SSH on your Raspberry Pi without a screen. We will also show you how to find the IP address of your Raspberry Pi and how to open a SSH connection.

You’ll need a SSH client software: PuTTy in Windows or Terminal in Linux/macOS.

SSH is disabled by default on any Raspian distribution after 2016 for security reason because all Raspbian images come with a user “pi” and the default password “raspberry”.

How to enable SSH:

  • If you have a keyboard/screen and access to the GUI, you just have to enable SSH in the RPI configuration program (or typing sudo rasps-config in command line) and reboot.
  • Alternatively, you enable and start SSH in command line :
sudo systemctl enable ssh
sudo systemctl start ssh
  • If you don’t a keyboard/screen, you need to use a blank boot file:
    • First, create an empty ssh file on your desktop computer, the one you use to format and generate the microSD boot card for your Raspberry Pi;
    • Mount the microSD boot card with Raspbian distribution on your desktop computer then navigate to the boot folder.
    • In boot, create a file without an extension and name it ssh (on MacOs or any Linux, you can use the touch command as well).
    • Unmount/Eject the microSD card.
    • Boot up your Raspberry Pi with this card.

To connect to your Raspberry, you now need to know its IP address :

hostname -l

Then use your SSH client software on your desktop computer to connect via SSH to your Raspberry Pi (we assume pi is still your default user account) (Windows users: use PuTTy instead):

ssh pi@[ip_address]

The first time you connect, you will get asked to accept the RSA key. Just type yes, and a new SSH session starts.

Then you can open as many terminal sessions as required. But keep in mind that ssh can also send remotely shell commands from your local desktop computer to your Raspberry Pi without opening any terminal session.