Raspberry Pi: Enable SSH Headless (Without Monitor)

If you are going to use a Raspberry Pi headless (without a monitor), you should know that for security reasons the SSH server in Raspbian is disabled by default.

In order to connect to the headless Raspberry Pi, you should enable SSH in advance and this can be done even before the first boot.

In this small note i will show how to enable SSH in Raspbian if the Raspberry Pi is without a monitor and keyboard.

Cool Tip: How to find the Raspberry Pi’s IP on network! Read more →

Enable SSH on Raspberry Pi Without Monitor

To enable SSH on Raspberry Pi you can insert a microSD card with Raspbian into your computer and create a file named ssh (without any extensions) in the boot partition.

You can do this from GUI (graphical user interface) of your operating system or from the command line.

The ssh file: The content of the file does not matter – it may contain text, or may contain nothing at all.

Below i will show how to enable SSH on a Raspberry Pi from the command line in Windows, MacOS and Linux.

Windows

Identify the letter of the boot partition on the microSD card with Raspbian:

C:\> wmic logicaldisk get deviceid, volumename, description
Description       DeviceID  VolumeName
Local Fixed Disk  C:        Windows
Removable Disk    D:        boot

Enable SSH by creating the empty ssh file from the Windows command prompt (CMD):

C:\> type nul > D:\ssh

MacOS

Enable SSH on Raspberry Pi from the terminal in MacOS:

$ touch /Volumes/boot/ssh

Linux

Identify the mount point of the boot partition on microSD card with Raspbian:

$ lsblk
NAME                MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                   8:0    0 115,5G  0 disk 
└─sda1                8:1    0 115,5G  0 part 
  ├─mint--vg-root   253:0    0 114,5G  0 lvm  /
  └─mint--vg-swap_1 253:1    0   980M  0 lvm  [SWAP]
mmcblk0             179:0    0  29,7G  0 disk 
├─mmcblk0p1         179:1    0   256M  0 part /media/user/boot
└─mmcblk0p2         179:2    0  29,5G  0 part /media/user/rootfs

Enable SSH by creating the empty ssh file from the Linux command line:

$ touch /media/user/boot/ssh

Cool Tip: Raspberry Pi’s default password & how to change it! Read more →

Enable SSH on Headless Raspberry Pi

Once the ssh file is placed onto the boot partition of the microSD card with Raspbian, you can eject it and plug into your headless Raspberry Pi.

When the Raspberry Pi boots, it looks for the ssh file and if it is found, it enables SSH and deletes the file.

Leave a Reply