How to reset the root password on a Raspberry Pi

Put the Raspberry Pi SD card into a linux computer.

(If you do not have a linux computer you will need to install software that can read linux file systems)

Open the file /etc/passwd located on the SD card (you may need to be a super user to access this file on the SD card)

You should see the “pi” user, it will look something like this:


Replace this complete line with the following:


This is the encrypted value for “password”. So now the password for the “pi” user is simply “password”.

Put the SD card back into the Pi, boot it up, login using pi/password, then change your password again.




Just wanted to leave my thanks. I had no luck with the “add ‘init=/bin/sh’ to cmdline.txt” route, it just kept hanging on boot. This worked great! Thanks


Also wanted to thank you a ton! Was very close to to doing a cumbersome reflash of armbian on an orange pi (and losing all the setup I had already done).