Andrew Gable

ProjectsResumeBlog

Resetting Raspberry Pi Password

02 August, 2014 - 2 min read

I have a free weekend to goof around on my Raspberry Pi. I was trying to SSH into the Pi, and I couldn't seem to remember my password. Here is a quick tip on how to reset the password.

First, power down the Raspberry Pi (I yanked the USB cord from the Pi). Then remove the SD card and open it up on your computer. Once you have the SD card opened, find the file cmdline.txt. Hopefully your file looks something like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline rootwait

Add init=/bin/sh to the last line, so it looks like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline rootwait init=/bin/sh

Eject your SD card, put it back into the Pi and turn it on. You should now see the normal start up, then once it is done loading the prompt appear with the blinking cursor.

Type the command passwd pi (if your user name is 'pi'). Then type in your new password (it will ask for it twice). Once again, turn off the Raspberry Pi and mount the SD card on your computer. Remove the init=/bin/sh from the last line, so it looks like:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline rootwait

Eject the SD card, and reboot your Raspberry Pi. Once everything is booted, type in your user name and new password and you should be good to go!

I will be moving my website and blog to be hosted by my Raspberry Pi over the weekend and will keep the blog updated with posts about my experience.

© 2020 Andrew Gable