Don’t remember the password you set while installing Raspberry Pi OS? It happens.Alternatively, you can use the GUI tool provided by You just have to type this in the terminal:I hope this tutorial helps you reset the password on your Raspberry Pi OS. Let me know if you have questions.
Method 1: If you can auto login
Table of Contents
You need a separate computer, preferably running Linux here.Now when you boot into the Pi, it will drop you into the root shell. In here, you can run commands as root and make changes to your system.mount -o remount, rw /
Enter the new password twice and then use this command to make sure that the changes are saved to the disk:
There should be one or more lines and you have to add init=/bin/sh
at the end of this last line, NOT on a new line. There must be a space before init=/bin/sh.
Use the command below to reboot into Raspberry Pi OS but temporarily bypassing the root shell:
Method 2: If you cannot auto login
This is slightly complicated and longer procedure. If you cannot log in to your Raspberry Pi OS, you can modify a few parameters to boot into the root shell and reset the password from there.Plug the modified SD card into the Pi again and power it on.
Step 1: Modify cmdline.txt file
Now, this last line should look like this.sync
If that’s the case, you are in luck. Raspberry Pi OS is configured to not ask for a password with sudo. Since you can log in automatically, and no password is required for sudo, resetting the password will be super easy.passwd username
Resetting the Raspberry Pi OS password is not complicated. In this tutorial, I’ll cover both cases where you can auto login and where you cannot login to your system.
Step 2: Boot Raspberry Pi into the root shell
exec /sbin/init
In here, under the System tab, you’ll see the option to change the password.
sudo nano /boot/firmware/cmdline.txt
But for that, you have to remount the system with read-write access (you must type the command exactly):Raspberry Pi OS is set to auto login and doesn’t even need password while using sudo. Since you are hardly entering the password anywhere, it is only human that you’ll forget it.Let’s start with the first method.console=serial0,115200 console=tty1 root=PARTUUID=585e914d-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles cfg80211.ieee80211_regdom=IN init=/bin/sh
Here’s the deal: By default, Raspberry Pi OS is set to automatically log in to the system without requiring a password.There could be a few other methods for resetting the Raspberry Pi password. I came across them in various forum discussions. However, I find these two the most reliable options. Take out the micro SD card from the Pi and put it in your computer. On Linux, it should automatically mount. All you have to do is to edit the /boot/cmdline.txt file.sudo passwd username
You can do it graphically or use the terminal; the choice is yours.Next time you boot, you’ll normally boot into your system.