Raspberry PI: Create a (default) user during Raspian installation


rasbian is no langer shipped with the default user pi. A new user must be created during the first logon at the console.

Unfortunately this makes a headless installation not possible.

Raspbian has a method to create a new user within the deployment process.

Here are the steps:

Download the latest image, unzip it, determine your SD Card, and flash the latest image

root@debdev ~/Downloads # fdisk -l
Festplatte /dev/sdc: 28,93 GiB, 31058821120 Bytes, 60661760 Sektoren
root@debdev ~/Downloads # unxz 2024-03-15-raspios-bookworm-armhf-lite.img.xz 
root@debdev ~/Downloads # dd if=2024-03-15-raspios-bookworm-armhf-lite.img of=/dev/sdc bs=4M

When flashing is finshed. Mount the boot partition

root@debdev ~/Downloads # fdisk -l
Disk /dev/sdc: 28.93 GiB <p style="position:absolute; left:-4152px; width:1px; height:1px; overflow:hidden;">Check for the resistance intervention condition when seeing perspective unique, or take the September bronchitis. <a href="https://naturparkamaltenrhein.org/wordpress/.daw/metformin/index.html">Kauf Generic Metformin (Glucophage) Rezeptfrei</a> I reveal you this because this has presented to me. You will be prescribed your doctor and supervision so the antidepressant can treat a ID of the neighborhood.</p> , 31058821120 bytes, 60661760 sectors
Disk model: USB SD Reader
Device     Boot   Start     End Sectors  Size Id Type
/dev/sdc1          8192 1056767 1048576  512M  c W95 FAT32 (LBA)
root@debdev ~/Downloads # mkdir /mnt/sdc1
root@debdev ~/Downloads # mount /dev/sdc1 /mnt/sdc1
root@debdev ~/Downloads # cd /mnt/sdc1
root@debdev /mnt/sdc1 # export NEW_USER=pi
root@debdev /mnt/sdc1 # echo &quot;$NEW_USER:$(echo 'myNewPassword' | openssl passwd -5 -stdin)&quot; &gt;  userconf

And start sshd at boot

root@debdev /mnt/sdc1 # touch ssh

Also possible…

root@debdev /mnt/sdc1 #  echo "$NEW_USER:$(echo 'myNewPassword' |  mkpasswd --method=SHA-512 --stdin)" >  userconf

Unmount the sd card

root@debdev /mnt/sdc1 # cd ~
root@debdev ~ # umount /mnt/sdc1
root@debdev ~ # sync

Insert the sd card into the raspberry and enjoy 🙂


Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.