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:

pi:$6$DYC5BlZ3$drMksdfpLq/zEkby6gb/m.W/b23423q7K9ery31fV65R7AyAcEymg7a9fE6JNRqbasdflkidwEPha1imMq.kJ61:17002:0:99999:7:::

Replace this complete line with the following:

pi:$6$nr7jrCVL$ZRCRDNJuB1Bc8JegDSnaKDyC6WtK4AftXcXKrkCKXAFP5Hbhg.JPhbEU1fUmeVbcAEqcnwQSrwPcO6LxAbCoc0:17044:0:99999:7:::

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.

Enjoy!

 

2 thoughts on “How to reset the root password on a Raspberry Pi

  1. John

    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

    Reply
  2. Alec

    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).

    Reply

Leave a Reply to John Cancel reply

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