How to reset a forgotten password on the Raspberry Pi?

in #raspberrypi7 years ago

How to reset a forgotten password on the Raspberry Pi?

In the Raspbian distribution, the default user is pi and the default password is raspberry. When setting up the single-board computer, you should assign your own secure password. Now it can happen that one has forgotten the password and can no longer log on to the Raspberry Pi. It is not necessary to perform a reinstallation because it can be easily reset. With this recipe you can easily reset the password, so you can log in again as usual on the Raspberry Pi.

  1. Remove the microSD card from the Raspberry Pi and insert it into a card reader on the computer.
  2. In the partition boot find the file cmdline.txt
  3. Open the file with an editor and add the suffix (after a space) at the end of the first line
    init=/bin/sh
    Save the file
  4. Then plug the microSD card back into the Raspberry Pi and boot it
  5. Now enter the following command in the console:
    mount -o remount,rw /
  6. Then enter the following command:
    passwd pi
    Now you will be asked twice for the new password, which you then enter. Here pi is the user name whose password you want to change. You can also change the username if you want to change the password for root or a custom user.
  7. To save the settings, enter the following in the console:
    sync
    exec /sbin/init
  8. Now the changes from point 3 have to be reversed. Open the file cmdline.txt with the following command:
    sudo nano /boot/cmdline.txt
    Remove init=/bin/sh at the end of the first line (with the previous space). Save the file with Ctrl-x, then y and Enter again. Of course, you can also make this change to another PC with a card reader.
  9. The password has now been reset and the Raspberry Pi can be used as usual. Start the Raspberry Pi now
    sudo reboot
    Done!
Sort:  

Congratulations @electrodrome! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @electrodrome! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 57687.08
ETH 2333.23
USDT 1.00
SBD 2.36