Raspberry Pi: Forgot root password - you can do that
If you have forgotten the root password for your Raspberry Pi, you do not have to reset the entire system immediately. In this article we show you how you can easily change your password.
Change root password on Raspberry Pi
To change the root password, all you have to do is follow the steps below. However, you need physical access to your Raspberry Pi:
- Shut down the small computer and remove the SD card with the operating system.
- Read the card with a card reader on your computer and open the "Boot" folder.
- Open the "cmdline.txt" file with the editor and add the addition "init = / bin / sh" to the end of the first line.
- Then you have to reinsert the SD card into your Raspberry Pi and start it with the monitor and keyboard connected.
- You must now type "mount -o remount, rw /" and then "passwd root" in the console. Now you can set a new password for the root user.
- Finally, execute the "sync" and "exec / sbin / init" commands.
- Now switch your Raspberry Pi off and remove the addition from point 3.
- When restarting, you can now log in with your new password.