Enabling SSH if only the filesystem is available

AKA you are trying to install Raspberry Pi OS Lite headlessly, yet someone didn't include the service file responsible for enabling SSH.

  1. Mount the medium:
    # Find which device corresponds to the card:
    # Make a mount point:
    mkdir /mnt/ext01
    # Mount, use device ID from earlier:
    mount /dev/<device> /mnt/ext01
  2. Link the service file (the link is relative to the path on the mounted medium):
    ln -s /lib/systemd/system/ssh.service /mnt/ext01/etc/systemd/system/multi-user.target.wants/ssh.service
  3. Unmount the medium:
    umount /mnt/ext01
  4. Return the medium into the correct device
  5. Boot and hope for the best