Secure Shell (SSH) is a cryptographic network protocol used for a secure connection between a client and a server. In the recent versions of Raspberry Pi OS, the SSH access is disabled by default but it can be easily enabled.
Here we are going to show you how to enable SSH on a Raspberry Pi board. Enabling SSH will allow you to remotely connect to your Pi and perform administrative tasks or transfer files.
We’re assuming that you have Raspberry Pi OS
Enabling SSH on Raspberry Pi Without a Screen
If you don’t have a spare HDMI display or keyboard available to hook up the Raspberry Pi you can easily enable SSH by placing an empty file named ssh ( without any extension ) into the boot partition.
To enable SSH on your Raspberry Pi perform the following steps:
- Power off your Raspberry Pi and remove the SD card.
- Insert the SD card into your computer’s card reader. The SD card will mount automatically.
- Navigate to the SD card boot directory using your OS file manager. Linux and macOS users can also do this from the command line.
- Create a new empty file named ssh, without any extension, inside the boot directory. On MacOS you could use the command:
sudo mkfile -nv 1b ssh
- Remove the SD card from your computer and put it in your Raspberry Pi.
- Power on your Pi board. On boot Pi will check whether this file exists and if it does, SSH will be enabled and the file is removed.
That’s all. Once Raspberry Pi boots up you can SSH into it.
Enabling SSH on Raspberry Pi
If you have an HDMI monitor plugged into your Raspberry Pi you can enable SSH manually from the desktop GUI or from the terminal.
Enabling SSH from GUI
If you prefer a GUI over the command line, perform the steps below:
- Open the “Raspberry Pi Configuration” window from the “Preferences” menu.
- Click on the “Interfaces” tab.
- Select “Enable” next to the SSH row.
- Click on the “OK” button for the changes to take effect.
Enabling SSH from the terminal
- Open your terminal either by using the Ctrl+Alt+T keyboard shortcut or by clicking on the terminal icon and start the raspi-config tool by typing:
raspi-config
- Navigate to “Interfacing Options” using key up or key down and press Enter.
- Navigate to “SSH” and press Enter.
- You will be prompted whether you like to enable the SSH server. Select “Yes” and press Enter.
- The next window will inform you that the SSH server is enabled. Press Enter top go back to the main menu and select “Finish” to close the raspi-config dialog.
Alternatively, instead of using raspi-config tool, you can simply start and enable the ssh service with systemctl:
sudo systemctl enable sshsudo systemctl start ssh
Connecting Raspberry Pi via SSH
To connect to Pi via SSH you will need to know your Raspberry Pi IP address. If you are running the Pi without a screen, you can find the IP address in your router’s DHCP lease table. Otherwise, if you have a monitor plugged in, use the ip command to determine the board IP address:
ip a
When you’ve found the IP address, you can connect to your Raspberry Pi from your computer. Windows users can use an SSH client like PuTTY .
Linux and macOS user have an SSH client installed by default, and can SSH into the Pi by typing:
ssh pi@pi_ip_address
Change pi_ip_address with the IP Address of your Pi board. If you have not changed the “pi” user password, the default one is raspberry.
When you connect through SSH for the first time, you will be prompted to accept the RSA key fingerprint, Type “yes” to continue.
Once you are logged into your Raspberry Pi you will be greeted with a message similar to the one below.
Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l
Leave a Reply