1

i forgot the password for my raspberry pi, but it is still stored in the default-settings of the raspberry pi imager. Is there any way to get the password back to plain text. my problem is i dont have a screen + mouse + keyboard avaiable for weeks, and really want to keep the config of my pi. any ideas? can i just copy the stuff from the sd-card except the password-file?

1 Answer 1

1

You can fix your Rpi without console. You need to put Rpi's sd card into your PC.

First add to cmdline.txt:

systemd.run=/boot/runonce.sh systemd.unit=kernel-command-line.target

Then create runonce.sh script to set password to what you need:

#!/bin/bash
set +e
echo 'username:password' | chpasswd
rm -f /boot/runonce.sh
sed -i 's| systemd.run.*||g' /boot/cmdline.txt
exit 0

Boot Rpi.

2
  • I just did that on OctoPi and it didn't work. Any way to see why?
    – Mołot
    Commented Nov 29, 2023 at 11:37
  • I won't be able to tell. I am unfamiliar with OctoPi but if it uses systemd and FAT partition is mounted on /boot it should work. Commented Dec 5, 2023 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.