0 Google+ 0 Reddit 4 StumbleUpon 0 Pinterest 0

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.

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

init=/bin/sh 1 init = / bin / sh

Your cmdline.txt should now look like this:

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.

passwd pi 1 passwd pi

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:

sync exec /sbin/init 1 2 sync exec / sbin / init

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!