Skip to main content
How to

How to Change Raspberry Pi Default Password & More

By August 25, 2026No Comments

The Raspberry Pi is a remarkably versatile single-board computer, but its security often hinges on one critical detail: its login credentials. For years, the default username and password for Raspberry Pi OS, formerly Raspbian, were public knowledge: pi and raspberry. This guide shows you how to change Raspberry Pi default password and what to do if you get locked out. Before we head to the tutorial, here is a myth about Raspberry Pi default passwords. 

SUGGESTION – If you can’t seem to remember your Raspberry Pi device password, let alone passwords for all your devices, consider using the best password manager. FastestPass generates extremely secure passwords that you can store in its vault. All you need is your master key to access all of them. 

The Raspberry Pi Default Password “Myths” in [year]

You will find one of the biggest updates: There is no longer a universal default password for new Raspberry Pi installations. Starting with Raspberry Pi OS releases after 2022, mainly the Bullseye version, the Raspberry Pi Foundation eliminated the default “pi” user to improve security. Here are the latest updates: 

  • For the latest setups: When you flash a modern Raspberry Pi OS image using the Raspberry Pi Imager, it’s required that you create a custom username and password during the initial setup process. You won’t be able to boot into the OS without defining these credentials. You can choose “pi” and “raspberry” if you wish, but this is highly discouraged for obvious security reasons.
  • For legacy systems: If you are using an older version of Raspberry Pi OS, prior to this change, the default credentials remain Username: pi and password raspberry.

Also: How to Change Hotspot Password on Your Smartphone

Why Did the Default Raspberry Pi Password Change?

The elimination of a default user was a direct response to significant security threats. Attackers actively scan the internet for Raspberry Pi devices and use automated scripts to attempt logins with well-known default credentials.

The danger is not theoretical. There is a known vulnerability, CVE-2021-38759, showing that Raspberry Pi OS versions through 5.10 left the default pi account password unchanged. This allowed attackers to easily gain administrator privileges.

Furthermore, self-propagating SSH worms have been observed compromising vulnerable Raspberry Pi devices in seconds. They did this by using these default credentials to enroll them into botnets.

Legislation in some countries now also forbids internet-connected devices from having default login credentials.

How to Change Your Raspberry Pi Password (3 Methods)

Whether you’re securing an older system or simply want to update your password, the process is straightforward. Here’s how to get started:

Method 1 – Using the Command Line (Terminal)

This is the most common and quickest method for both headless (no monitor) and desktop systems. Here’s what to do: 

  • Open a terminal window.
  • Type the following command and press “Enter”:
  • bash
  • passwd
  • You will be prompted to enter your current password (for security, no characters will appear as you type).
  • Next, enter your new password and press “Enter.”
  • Re-enter the new password to confirm it.
  • If successful, you will see a message:  passwd: password updated successfully.

To change another user’s password (requires sudo privileges):

bash

sudo passwd [username]

Replace [username] with the actual username.

Also: How to Find Your Wi-Fi Password on iPhone

Method 2 – Via Raspberry Pi Configuration Tool (raspi-config)

This provides a menu-driven interface, ideal for desktop users.

  • Open a terminal window.
  • Launch the configuration tool with:
  • bash
  • sudo raspi-config
  • Use the arrow keys to navigate to “System Options” and press “Enter.”
  • Select “Password.”
  • Follow the on-screen instructions and enter your new password. 
  • Click on “Finish” to save the changes. 

Method 3 – Using the GUI (Desktop Only)

For a graphical approach on the full desktop version, here’s what to do:

  • Click on the Raspberry Pi menu in the top-left corner.
  • Navigate to “Preferences” > “Raspberry Pi Configuration.”
  • Click on the “System” tab.
  • Click the “Change Password…” button.
  • Lastly, enter your current and your new password in the required field. 

How to Change Raspberry Pi Default Username (For Legacy Systems)

  • If you’re looking to create stronger security on older systems, simply changing the password is not enough. You will also need to change the default pi username, as it is publicly known. The recommended method is to create a new administrative user and disable the pi account. Here’s how:
  • Create a new user: Replace Newuser with your desired username.
  • bash
  • sudo adduser newuser. You will be prompted to set a strong password for this new account.
  • Grant sudo privileges: Give your new user administrative rights.
  • bash
  • sudo usermod -aG sudo newuser
  • Log out and test: Log out of the pi account and log back in as your new user. Verify you can use Sudo successfully.
  • Disable the default user: Once you’ve confirmed the new user works, you can delete the pi user.
  • bash
  • sudo deluser pi

You may be prompted to remove the home directory and mail spool. Confirm if you wish to do so.

Also: Why Password Managers Matter for Streaming Password Sharing

How to Reset a Forgotten Raspberry Pi Password

If you forget the password you set for your Raspberry Pi, and you can’t seem to sign in, you can reset it by editing the boot configuration file. This process requires removing the microSD card and using another computer. Let’s get started:

  • Modify cmdline.txt: Remove the microSD card from your Pi and insert it into another computer.
  • Navigate to the boot or boot/firmware partition and find the file named cmdline.txt.
  • Open the file in a text editor.
  • Add init=/bin/sh to the end of the single line of text. Ensure there is a space before the addition and do not create a new line. It should look something like this:
  • text
  • … rootwait quiet init=/bin/sh
  • Save the file and safely eject the microSD card. 
  • Boot into a root shell: Insert the card back into the Raspberry Pi and power it on. It will boot directly into a root shell without prompting for a password.
  • Remount the filesystem as writable: At the root shell prompt, type:
  • bash
  • mount -o remount, rw /
  • Reset the password: Change the password for your user (e.g., pi or the username you created):
  • bash
  • passwd pi
    Follow the prompts to set a new password.
  • Revert Cmdline.txt: Shut down the Pi, remove the microSD card, and put it back in the other computer.
  • Remove the init=/bin/sh text you added to the cmdline.txt file and save it.
  • Eject the card, put it back in the Pi, and boot normally. You can now log in with your new password.

To Conclude

That’s a wrap! You now know how to change Raspberry Pi default password, why it’s necessary, and also how to change the username. 

For a step further to bolster security, Raspberry Pi OS 6.2 (released in [year]) now defaults to requiring a password for sudo commands on new installations.

Previously, users could execute administrative commands without a password. This change helps prevent unauthorized access if someone gains physical or remote access to an unsecured session. 

On existing systems, you can enable this feature in the Raspberry Pi Configuration tool under the System tab by turning on the “Admin Password” option.

Secure and Create Stronger Passwords Now!

Generate passkeys, store them in vaults, and safeguard sensitive data!


Subscribe to Our Newsletter

Receive the latest updates, trending posts, new package deals,and more from FastestPass via our email newsletter.

By subscribing to FastestPass, you agree to receive the latest cybersecurity news, tips, product updates, and admin resources. You also agree to FastestPass' Privacy Policy.

Leave a Reply