Re: Can't get into headless pi, passwor

Mar 02, 2025 Last reply: 1 year ago 1 Replies



>
> > It boots OK and the ssh deamon is running but the default username
> > 'pi' and password 'raspberry' don't work. How on earth do I get into
> > it to start it up?
>
> Did you use the RPI Imager to create your SD card? You need to create a
> password for the pi user now. As far as I have seen it does not come with the
> password of 'raspberry' any more since they upgraded to bookworm .. >

I think you can edit the boot partition to set a user up


"There are also mechanisms to preconfigure an image without using Imager. To set up a user on first boot and bypass the wizard completely, create a file called userconf or userconf.txt in the boot partition of the SD card; this is the part of the SD card which can be seen when it is mounted in a Windows or MacOS computer.


This file should contain a single line of text, consisting of username:encrypted- password – so your desired username, followed immediately by a colon, followed immediately by an encrypted representation of the password you want to use.


To generate the encrypted password, the easiest way is to use OpenSSL on a Raspberry Pi that is already running – open a terminal window and enter


echo 'mypassword' | openssl passwd -6 -stdin


This will produce what looks like a string of random characters, which is actually an encrypted version of the supplied password."


formatting link
I think you can also use the values in /etc/shadow on another system to clone a user and password.


But if you have another Linux system, and are using it to burn/modify the boot disk image for the pi, this method works extremely well.

There seems to be no command-line tool that relies purely on the system libcrypt (and implements exactly the set of algorithms supported by that) to hash and verify passwords.

I have my Python nixcrypt library and accompanying example command-line tool

formatting link
, if you can be bothered to install that.

Yes, that will work, provided the hash algorithms used are compatible. Which is usually the case, unless the system installations are from a few years apart. Recommendations as to which hash algorithms to use (and which to stay away from) tend to change somewhat over time.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required