Recover password

Feb 06, 2019 20 Replies

password reset is usually pretty simple. boot into a single user console, where a login is (most likely) not required. then run 'passwd' to create a password for root. log in as usual after that, using new password.

If you can't leverage single-user mode, and ALSO don't have a user capable of running 'sudo su' [mentioned earlier by someone else], you can boot up a different Linux image in which you know what the password is, and mount the SD card for the image you need to reset the password on, and THEN use 'chroot' and the 'passwd' utility to assign the password onto the other SD card's /etc/shadow and /etc/passwd files

so if you mount the original SD to /mnt, then you should be able to do this:

chroot /mnt passwd root (enter new password)

That assumes that you're running it on an RPi booted with a different but compatible Linux image and are logged in as 'root', so that doing the 'chroot' on the mounted SD card gets you "the OS" as you'd normally see it [and you can safely operate on it this way].

there may also be an easier way, but this should work for resetting a root password using a 'virgin' image in which you haven't changed the passwords from their default values.

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required