5 Easy Ways to Reset a Forgotten Password on Raspberry Pi
I set up Raspberry Pi systems all the time, so I know how it feels when you forget a password. If you’re stuck at login right now, don’t worry. I’ve got a few reliable ways to reset your Pi password and get back in fast.
Raspberry Pi OS has auto-login enabled by default, so most of the time, you can get access to the main user session without typing any password, and reset user passwords from there. If this isn’t possible, you can edit the /etc/passwd file to allow users to sign in without a password.
I’ve listed five ways to reset your Raspberry Pi password, from the simplest to the trickiest. Try the first one and then keep going down the list until you find the one that works for you. One of them should do the trick.
If you’re feeling lost in all the Raspberry Pi jargon, I’ve got something to help you out. I’ve created a free glossary that explains all the essential terms and abbreviations in a way that’s easy to understand. It’s a great resource to have by your side. Get your free copy here.
1 – Change Password via Control Centre or raspi-config
Use this method if you have a desktop environment and the session opens automatically on boot. In this case, you can directly change the password, without knowing the old one.
Once the GUI loads, go to main menu > Preferences > Control Centre.
Under the System tab, you’ll see a button to change the password for the current user:

It will ask you for a new password, without having to type the current one:
You might also like: Don't buy a new SD card until your read this.

So, this solution works even if you don’t know the current password. It’s perfect if you’re still able to get into your system, but have no idea which password to type when the system asks for more permissions (when you install new applications, for example).
If you’re on Raspberry Pi OS Lite instead, you can use raspi-config to change the password from the command line. You’ll find the “Change password” item under the “System Options” section.
The most recent Raspberry Pi OS update now separates desktop and console logins, so this might be helpful to you as well.
You can get answers from real experts in minutes.
Get help with your setup
But if you’re still stuck at the login page, this method won’t help. But I prefer starting with the easiest solution first, so that you don’t break your system if there’s no need to :-). Check the next sections if this method didn’t work for you.
Bonus tip: When I started, the hardest part wasn’t the setup, it was figuring out what to build next. I ended up creating a list of 75+ project ideas with links and difficulty, so it’s easier to just pick something and try it. Grab the list here.
If you want a clearer path than jumping from tutorial to tutorial, my book gives you a step-by-step roadmap to really understand your Raspberry Pi.
Check the book hereRelated: 3 Ways to Remove Password on Raspberry Pi (+Security tips)
2 – Log In With Another User to Change the Password
Use this method if you’ve created several users on your system but lost the password for only one of them. If other users have administrator privileges, they can reset any user’s password on Raspberry Pi.
Even if you only created one user when first installing Raspberry Pi OS, you can easily create new users for different roles and tasks—or even set a password for the administrator account (root).
You might also like: Pi5 vs. Pi4: I tested them, here's the result
If you had other users set up on the system where you forgot the password, you might be in luck! If you can access your system with another account that can use the sudo command, you can elevate to administrator permissions and reset the password:
- Get access to the command line (open a terminal, log in on Lite, or use SSH).
- Type the following command:
sudo passwd <username>For example:sudo passwd pat - You should get a prompt to set a new password for this user.

- Once done, you can log out and sign back in with the username and password you just set.
It only works if you’ve created other users beforehand. If this isn’t the case on your system, take a look at the next option, which is the last “easy” solution before we start editing files manually.
3 – Use an SSH Connection to Access Your Account
Use this method if you can still connect to your Raspberry Pi via SSH because the password was saved on your client (or you use SSH keys). In this case, you can reset the password via SSH.
If, like me, you’re using a smart SSH client (I use Termius) which saves all session credentials, you almost never type your password. And when you finally need it to install new applications, you might get stuck, as you don’t remember what the password was.

It would be the same if you created SSH keys to log in from other computers without password authentication. In this case, you can still access your account on the Raspberry Pi, but you have no idea what the password is.
Well, this is still an easy solution, as you can use the same command to reset the password as in previous solutions. Use raspi-config or type the following command to set a new password:sudo passwd pat
Now that we’ve explored all the easy solutions when you still have a way to access your system, what can you do when you’re stuck on the login page with no clue what the password is? Our next two solutions will help you with this.
You might also like: Not Every Raspberry Pi Project Is Worth Building
4 – Clear the Password From Another Linux System
If you can access your SD card from another Linux system, you can edit the /etc/passwd file to allow you to log in without a password. Use this method if you can’t access the current system but can boot from another SD card or USB key.
So, if you have a computer running Linux, just plug your SD card into it, and follow the instructions below.
However, if your computer is running Windows instead, you can’t edit the files on the SD card directly. In this case, your best option is to start the Raspberry Pi with another boot media, and follow the instructions from there.
Since I have Windows on my main computer, I decided to use a USB drive with Manjaro installed on it. I booted it on my Raspberry Pi and only plugged the SD card in once logged in to Manjaro. I then follow the instructions below to change the password on the SD card.

Bonus tip: When I started, the hardest part wasn’t the setup, it was figuring out what to build next. I ended up creating a list of 75+ project ideas with links and difficulty, so it’s easier to just pick something and try it. Grab the list here.
Whichever route you choose to get onto a Linux system, the procedure is to edit the SD card and disable the need for a password:
- Plug the SD card into your computer or Raspberry Pi.
- Open a terminal.
- Mount the SD card’s main partition on the current Linux system.
Some systems will do this automatically for you. On Manjaro, I had to manually enter:sudo mkdir /mnt/sd
sudo mount /dev/mmcblk0p2 /mnt/sd
Check this article for more details on how to mount drives on Linux. - Once the partition is mounted, you can edit the /etc/passwd file:
sudo nano /mnt/sd/etc/passwd - There is one line for each user on your system.
Find the line corresponding to the user you need to reset the password for.
For example, if it’s “pat”:
- Remove the “x” between the two colons (:).

- Save and exit (CTRL+O, CTRL+X).
You can now halt your current (temporary) system and boot again from the SD card.
(In my case, I shut down the Raspberry Pi, removed the USB key, and left only the SD card.)
On the login screen, you can type the username (“pat” in my example) and it won’t ask for a password. The session will open directly. Now, you can set a new password using Pi Configuration from the GUI, raspi-config, or this command directly:passwd
Tip: Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them. You can grab the PDF here if you want to save some time.
Stuck on this project? Ask me or other Pi users in the RaspberryTips Community. We help each other out and you'll get answers quick. Join and fix it together.
5 – Boot in Single-User Mode to Reset the Password (cmdline.txt)
Use this method if all other solutions aren’t available to you. If you only have one SD card or USB key and no other Linux system, this is your best option (not the easiest, but it works).
The idea here is to boot a minimal version of your system with access to the command line as root. This way, you can use it to reset your password.
- First, insert the Raspberry Pi’s SD card (or USB key) into another PC.
It can be any operating system (even Windows)—it doesn’t matter. - In the boot partition, find the “cmdline.txt” file and open it. It looks like this:
You might have to browse to the /boot/firmware/ folder to locate it.
I have an in-depth article on this website about cmdline.txt. I highly recommend reading it first, but I’ll give you a summary of how to reset your password here. - Add the highlighted text at the end of the line, as in my screenshot:
init=/bin/sh - Save the file, and eject the media.
- Put the SD card back into your Raspberry Pi, and turn it on.
The system will now boot almost like usual but will stop at a cursor where you can type commands.
- The partition is not mounted automatically, so you’ll need to do it with:
mount -o remount, rw /
Warning: the keyboard layout will be in QWERTY, so good luck if (like me) you use another layout :-). - Now that you’re in, you can change the password:
passwd <username>
For example:passwd pat(We are logged in as root, so you don’t need sudo.) - Force saving the changes to disk:
sync - Finally, power off the Raspberry Pi (halt and reboot commands won’t work).
Wait, you’re not quite done yet! Before restarting the Raspberry Pi:
- Put the SD card back into your other computer.
- Remove the text you added to the cmdline.txt file.
(So remove “init=/bin/sh” at the end of the line.) - Save, and eject the SD card.
- Put the SD card back into your Raspberry Pi.
On the next boot, use the password you just set, and it should work.
Phew—that’s it! You’re now back in control of your system, so don’t forget your password again :-). And if you want to avoid losing your passwords all the time, you should check out this project (it’s a password manager that you can host on Raspberry Pi).
Check this: 7 Surprising Uses for a Raspberry Pi
Not getting the same result?
Even when you follow every step, small differences in OS version, hardware or config can change the outcome. Instead of wasting time guessing, get help from people who have already fixed the same kind of issue.
- Get help on your exact issue
- Access step-by-step videos for tricky setups
- Browse the website without ads

Patrick, how do you get to pi-config if you can’t log in the first place?
Read the article :-).
The first 3 solutions only work if you have a way to open a session (auto-login, other account or SSH session saved on your client).
If not, you can try the two last ones.