HomeMy SetupResourcesNewsProjects/CodeFAQsContact
Raspberry Pi Projects > FAQs and HowTos > Reset Lost Password

Reset Lost Password

If you have set the pi user password and either can't remember what you set or it doesn't work after reseting it, the only way to rebuild the password is to reboot the Raspberry Pi in a special mode so that you can set the password to what you want.

One way to do this is to insert the card into a Windows machine and change the cmdline.txt file.

Changing the cmdline.txt

Put the card in another machine and edit cmdline.txt on the fat partition. Add init=/bin/sh to the end of the line of text that it already has and save the file.

Example

Before it might look like:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
After you add the command it will look like:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait init=/bin/sh

Put the card back in the Pi and apply power. The system should start booting and then pretty quickly drop you at a command prompt.

Reset the pi User password

At this command prompt type:

mount -o remount,rw /
passwd pi
(enter a new password)
sync
exec /sbin/init

The boot process will then continue and then pretty quickly drop you at a command prompt again.

Re-edit the cmdline.txt file in /boot and now remove the init=/bin/sh from cmdline.txt.

From that point on, when you reboot you should be able to use the new password you set for the pi user.





comments powered by Disqus
Copyright © 2014, all rights reserved. Manage
Page Creation by TNET using Boltwire v3.4.16 Hosting by TNET - Views #17153 - Ulterius Server
IP: 54.161.175.231 [ec2-54-161-175-231.compute-1.amazonaws.com] - Tue Sep 16 20:28:12 2014