reset raspberrypi password[raspberrypi]

connect the sd-card to your pc and add a init=/bin/sh at the end of the file /boot/cmdline.txt
for example change:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

to:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait init=/bin/sh

insert the sd-card again in your pi and change the password:
mount -o remount,rw /
passwd pi

then execute:
sync
exec /sbin/init

After your pi has booted remove the init=/bin/sh from /boot/cmdline.txt:
sudo nano /boot/cmdline.txt
and remove the init=/bin/sh from the end.
then exit with Ctrl + X and accept changes with y

or if the pi is headless:
https://blog.znn.info/passwort-recovery-raspberrypi/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s