The password: Changed it, forgot it – Raspberry Pi

Posted for my later reference.

It happened when I was about to connect the RPi to the interwebs. I changed the user password to something smart, then forgot it. Having not enabled the root user I was locked out.

As it turns out it’s really simple to reset. Just follow a simple step-by-step, like the one I found at rpi.tnet.com.

In short:

  1. Add init=/bin/sh to the end of cmdline.txt, which is to be found on the FAT-partition.
    Make sure the contents in this file stays in one line.
  2. Power up the RPi
  3. A command prompt magically appears
  4. Type the following:
mount -o remount,rw /
passwd pi
(enter a new password)
sync
exec /sbin/init

Remove the added command from cmdline.txt, power up the RPi and log in with the new password.