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…

Transforming Ideas to Business - Part 1

How much LEAN?The whole experience I had and am having with my work in startups and discussing with various founders of startups is going to presented in three parts. The goal is to share my experiences with Lean Startup, which could help you turn your idea into a successful business model. Step 1: Sharing If you have an idea and you are really confident that you can turn it into a viable business model, the next things
Share the idea with as many people as possibleCheck their pulse - how they feel about your ideaCollect their feedback - take it up constructivelyAre they ready to join you to take it forward The more people who are willing to join you in making this a success, the more chances for you to succeed. Step 2: Survey If you are still confident and you want to build on your idea, after taking the initial feedback into consideration, then do the following
Identify the target groupthe group of users who will be using you applications. ex: general public age groups, businesses ba…