Permit SSH On First Boot


SSL (Secure Sockets Layer) is a set of protocols for encrypting and transmitting data. TLS (Transport Layer Security) is the successor to SSL, though the initialism SSL is still used frequently.

SSH (Secure Shell) is an interactive tool that encompasses some of the features of SSL but provides the ability to log on to remote systems.

If you are setting up a new SD card for a Pi and want to use SSH to access the Pi for the first time, you'll need to create a file called ssh on the SD card. If the operating system finds this file when it starts, it enables SSH and then deletes the file. This gives you an opportunity to log on remotely and configure SSH permanently for future use.

The general steps are:

Step 1

Download and create an appropriate OS image on your SD card.

Step 2

Create a file called ssh in first partition on the SD card named boot. You can check that this is the correct location by looking for cmdline.txt, which will already be in the correct place.

Step 3

Put the SD card in your Pi and power it up.

Step 4

If this is a new Pi that has not been connected to your network before, logon to your local router to obtain the Pi's IP address, then use this IP address to logon to the Pi using PuTTY or Windows Terminal. If the Pi has been connected to your network previously, then it usually acquires the same IP address that it had previously. This is because when the router saves the Pi's MAC address it will usually allocate the same IP on the next occasion the Pi appears on the network.

Step 5

Set up SSH access using raspi-config.

sudo raspi-config

The menu options and locations in raspi-config change from time to time so work through the options to find and set up SSH so that it is enabled at boot time.

Exclamation mark The ssh file is removed after the Pi boots so it's important to set up SSH when you first log in. Otherwise you'll have to repeat steps 2 and 3 above.