How to recover a lost Raspberry Pi password

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on Reddit6Share on StumbleUpon0Pin on Pinterest0

About: There may come a time when you lost your login password for the Raspberry Pi. I recently had this happen to a small server I have been running on my home network, which I forgot about and needed to login to pull some logs. I was unable to login because I forgot the password for my ‘pi’ username. Unfortunately, there is no way to recover the original password that you have been using for the Raspberry Pi login however you can reset the password easily.

Objective: To recover and reset a lost Raspberry Pi password.

Material: You will need the following:

  • Raspberry Pi (Click the link to check out the price on Amazon. Usually around $37 with free shipping)

Instructions: Resetting your Raspberry Pi password is simple. You will basically need to edit a text file that’s located on the /boot/ mount of your Raspberry Pi SD card.

Start off by removing your SD card from the Raspberry Pi and inserting it into your computer. Located the /boot/ mount and find the ‘cmdline.txt’ file. Open it in the text editor of your choice. Below is what my cmdline.txt looks like before editing. Your text file should look similar.

pi_lost_pass_1

Now we will add the following to the end of cmdline.txt

Your cmdline.txt should now look like this:

pi_lost_pass_2

Save cmdline.txt and reinsert your SD card into your Raspberry Pi and boot it up. You should eventually see a blank line which allows you to start typing commands. Change your password by typing ‘passwd <username>’ where <username> is the user you want to change the password for.

20160312_223341_001

You will get prompted to enter and new password and then confirm the password you typed. After setting your new password type the following commands to continue:

The Raspberry Pi will now continue booting like normal and you should see a login screen. Login with your new password to verify that it works. After that let’s do a shutdown and remove your SD card again. Navigate to the /boot/ mount and open cmdline.txt and remove the command we inserted earlier. Save the text file and reinsert your SD card into the Raspberry Pi and you are good to go!

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on Reddit6Share on StumbleUpon0Pin on Pinterest0

2 Comments

  • Matt

    December 10, 2016

    i cant find the boot mount anywhere on the SD card, is there anywhere in particular i should be looking?

    Reply
    • dayz

      December 10, 2016

      When you insert your SD card into your computer you should get 2 mounts that pop up. One of them will be your boot mount and the other one will have a bunch of folders which is the actual Operating system. I am unsure if it pops up differently on Windows or !ac but thats how it pops up in linux. I use linux mint. Let me know if that helps.

      Reply

Leave a Reply