Skip to main content

Access and reset forgotten password of a Raspberry Pi

Background

For the last few years, I have been reading a lot about IoT and its evolution. Considering it to be a form of technological advancement, I wanted to know if it really lives upto its hype. So I started looking at options of how I can explore its depths and unlock its true potential. And now I decided to buy a "Raspberry Pi 3" and get on with it...

I am a pretty newbie using a Raspberry Pi 3 (RbPi3) + Raspbian Jessie image from 2017-01-11

Problem

After a while of playing around I decided to finally start working with a real-life use case. So I went on with reading about different applications and had to shelf the rbpi3 for a while. Meanwhile, I managed to successfully forget the new password I set for the pi login.

Solution

This can be solved in two different ways...

Access with Keyboard

  • Connect to  RbPi (using a keyboard &/ monitor and open the terminal (in Raspbian))
  • Enter command sudo su to login as root (no password by default)
  • Now give command passwd pi
  • Upon prompt you have to enter the new password twice which will change the password for user pi

Access without Keyboard or Monitor

  • Power down your RbPi and remove the microSD card
  • Backup your cmdline.txt file and open it in a text editor
  • Add init=/bin/sh at the end. This will cause the RbPi to boot in single user mode
  • Insert your card back in and start booting the RbPi. When there is a prompt enter su to log in as root (no password needed)
  • Now give command passwd pi
  • Upon prompt you have to enter the new password twice which will change the password for user pi
  • Power down your RbPi again and remove the card and replace the cmdline.txt with the original file (which you have as backup)


Popular posts from this blog

Me, Myself & My-Tech

Hackathons - my newest passion. Rediscovering myself...After some deep thought (with no help from deep mind), only recently I rediscovered my "Hackerself", which was buried deep within -
I started off as a Hacker at a very young age, always curiously trying to break and fix things, playing with my grandpa's screwdriver. In my first job, I worked as a System-Integrator for the Telecom CoE team almost 2 years, my first experience as a software Hacker, trying to crash hardware by giving them my own new firmware and bring down systems and networks.
My next best experience was working at a start-up for almost 3 years, learning and delivering with various new technologies. Then came the settling down a bit, when I have started working at a so-called “Big Indian” tradition IT firm during its dying days of innovation. After some very boring and uneventful hacking-years, I finally sprung back to life when I started participating to Hackathons - my first try was at a Hackathon org…

Age of the User

The Beginning When companies like Google had begun with the idea of understanding the users (of their Services) and their behaviours, they have started a new revolution in the data study and they have opened the door to a new dimension. This is now called Data Science. Not just Google, there are loads of companies before and after it, that created such impact, but Google was able to do it at an exponential scale due to the availability of data and usage of machines for studying and learning from this data. A few years ago, probably when I was born in the 1980s, maybe there was no one who even imagined that something like that would be possible. The Context of Everything Even though there is a method to the madness in the tracking of a (potential) asset (user), it has taken us to the extreme. Many of us are already tracking every action like moment, step, climb, breathe and heart-beat at every location and also share it socially.

In the not so distant future most objects or things we use…