Saturday 11 January 2014

Can't remember your username or password for your pi?


With one username and one password to rule them all... ok I'll stop with the LoR references.

Big night out? That's alright, big nights out are cool (like bow-ties), but can wreck havoc on the memory cache of your brain. (Wow I'm a nerd, who talks like this?) If you're running Raspbian (Debian Wheezy), on your raspberry pi, then fortune smiles. Follow these instructions and all will be right in the world again.

How to find out your user name

  1. Take the SD card out of your pi and put it into your computer
  2. Open the largest petition (the one with the most bytes, dummy!)
  3. Open the folder named home
  4. Inside the home folder you will find folders that are named with all of the user names of that pi. If there is only one user then there will only be one folder (and it will probably be called pi)

How to reset your password on your pi

  1. Take the SD card out of your pi and put it into your computer
  2. Open the smallest partition (usually the smallest one is called boot)
  3. Open to edit the file named cmdline.txt
  4. At the end of the file add a space and add init=/bin/sh
  5. Save the file and demount the SD card from your computer
  6. Put the SD card back into the pi
  7. Connect the power and wait for it to boot
  8. Type passwd pi and press enter
  9. It will ask you to put in your password twice (so this time make sure it's memorable!)
  10. After this has been accepted you'll then need to power off the pi to remove the SD card again, (not ideal, but the kill command doesn't seem to work)
  11. Put the SD card into your computer again, and open the smallest partition and the file named cmdline.txt (just as you did before in instructions 2 and 3)
  12. Now remove the space and init=/bin/sh (which you had added before. This needs to be removed so that next time you boot up your pi it's not going to start in 'safe mode' again)
  13. Save the file and demount the SD card from your computer
  14. Put the SD card back into the pi
  15. Connect the power and wait for it to boot
And now you're ready to log in with your shiny brand new password ...which hopefully you wrote down on a PostIt and stuck to the back of your pi or can still remember! :)