Skip to content

raspbian / raspberry pi os

create user for ssh on headless pi

the raspberry pi OS doesn't ship with the pi user anymore (see here for more information and how to create a user), they have outlined several ways how to create a user. so here's my own copy paste reference for the future when I need a user on a headless pi:

generate an encrypted password:

the openssl version which ships by default with macOS doesn't support generating sha512 passwords, so I'm using the homebrew version:

/opt/homebrew/opt/openssl/bin/openssl passwd -6

copy your generated password, and create a new file on the sd card:

vi /Volumes/bootfs/userconf.txt

the contents should look like username:password, for example:

jonas:$6$WI1IQhq59s3IayNg$h/CZGHz/hlH4ksVgW8mI5kWyZ1vURk3KCFcLajACuIfsUiITYW1zapqC8ov4AHBatpHdpM/uJ5IfSob0y2nBY.

enable ssh on boot / headless login

headless login, you know: create a file named ssh on the boot volume, ex:

touch /Volumes/bootfs/ssh

configure wifi

same as with ssh, create a file called wpa_supplicant.conf in the boot volume, like so:

/Volumes/bootfs/wpa_supplicant.conf

then go here for the config

configure wifi on raspberry pi os 12 / bookworm

for some reason things are becoming more complicated with raspberry pi os.

this is how you can do it with a TUI:

sudo nmtui

or CLI:

sudo nmcli connection add type wifi ifname wlan0 con-name "MyNetwork" ssid "MyNetwork"