Skip to content

Instantly share code, notes, and snippets.

@stephenchew
Created June 8, 2024 14:21
Show Gist options
  • Select an option

  • Save stephenchew/f67e33bc4ea3bd4abd12a25eb9142482 to your computer and use it in GitHub Desktop.

Select an option

Save stephenchew/f67e33bc4ea3bd4abd12a25eb9142482 to your computer and use it in GitHub Desktop.
Headless setup of Raspberry PI

Enable SSH

  1. Locate the partion of the newly flashed Raspberry Pi OS.
  2. Create a new empty file named ssh with no extension in the boot partition.

or

echo '' > ssh

Set up username and password

Raspberry Pi OS has removed the default user pi due to security reason. A default user has to be set up manually for a headless setup.

Create a file userconf in the boot partition.

This file should contain a one liner in the format of username:encrypted-password. Encrypted password can be generated using the following command

echo 'mysecretpassword' | openssl passwd -6 -stdin

Example content of the file pi:$6$vUTmd2FA3SDwyo8D$VVHQezE4UMpTr..5urbrUQho1p.q0sRD40MI0BjaEJguBzPFrJEGWDS.OKGkwn1laXe5Bma1PZhnl8gG36xzq0

Alternatively use the following command

echo pi:$(echo 'mysecretpassword' | openssl passwd -6 -stdin) > userconf

Where pi is the username and mysecretpassword is the password


Reference

https://www.raspberrypi.com/news/raspberry-pi-bullseye-update-april-2022/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment